6
$\begingroup$

I am trying to backtest my ARCH model using ugarchroll from rugarch package in R, but I am getting this warning message

"Warning message: In .rollfdensity(spec = spec, data = data, n.ahead = n.ahead, forecast.length = forecast.length, :

non-converged estimation windows present...resubsmit object with different solver parameters."

This is my code

library(quantmod)
library(rugarch)

getSymbols("SPY")
rets=ROC(SPY$SPY.Close)
tgarch = ugarchspec(mean.model = list(armaOrder = c(1, 1)), 
                    variance.model = list(model = "sGARCH"),
                    distribution.model = "std")
garchroll<-ugarchroll(tgarch, data = rets,n.start =500, 
                      refit.window="window", refit.every =200)
$\endgroup$
  • $\begingroup$ thank you to everyone who has liked this question I've received a lot of points but it would still be nice for someone to answer my question lol $\endgroup$ – Pelumi Oct 8 at 14:32
2
$\begingroup$

The error arises because the first element of rets is NA (which is expected behavior as ROC calculates the rate of change of a series, but a previous value prior to the first element is naturally not available).


To avoid this, add the optional argument na.pad = FALSE, i.e. rets = ROC(SPY$SPY.Close, na.pad = FALSE):

> rets=ROC(SPY$SPY.Close)
> head(rets)
               SPY.Close
2007-01-03            NA
2007-01-04  0.0021198638
2007-01-05 -0.0080082993
2007-01-08  0.0046144192
2007-01-09 -0.0008502445
2007-01-10  0.0033260425
> rets = ROC(SPY$SPY.Close, na.pad = FALSE)
> head(rets)
               SPY.Close
2007-01-04  0.0021198638
2007-01-05 -0.0080082993
2007-01-08  0.0046144192
2007-01-09 -0.0008502445
2007-01-10  0.0033260425
2007-01-11  0.0043708988
$\endgroup$

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.