-1
$\begingroup$

I used the ugarchroll in rugarch packages and got a strange error:

Error in ans$res: $ operator is invalid for atomic vectors

But I don't have $ in my code:

library(rugarch)
spec = ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,1),
       submodel = NULL , external.regressors = NULL, variance.targeting = FALSE),
      mean.model = list(armaOrder = c(2,0), include.mean = F, archm = F,
      archpow = 1,arfima = F, external.regressors = NULL, archex = FALSE),start.pars = list(), fixed.pars
      = list(),distribution.model = "norm")

rollgarch_n=ugarchroll(spec,data1return, n.ahead = 1, forecast.length = 500,
   refit.every = 21,refit.window = "moving", solver = "hybrid", solver.control = 
     list(trace = TRUE),calculate.VaR = TRUE, VaR.alpha = 0.01, 
   keep.coef = TRUE)
$\endgroup$
  • $\begingroup$ When I run your code with data1return <- rnorm(1000) no errors are reported. Could you please provide the output of sessionInfo() and sample data? $\endgroup$ – Bob Jansen May 21 '17 at 11:52
1
$\begingroup$

I was running into the same error until I realized I had some NAs in the series of returns I was trying to model/forecast. After removing NAs the code worked perfectly. I hope this will solve your problem

$\endgroup$
  • $\begingroup$ please put such "answers" as comments $\endgroup$ – lehalle May 22 '17 at 11:54
  • $\begingroup$ I have encountered the same error, with no nulls in my data, so there is definitely still a problem here. $\endgroup$ – Coolio2654 Jan 17 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.