I am running an ARMA (1,1) Garch (1,1) model on some log return stock data. I am interested in backtesting this model on every day and using a rolling window of size 300. Whenever I attempt to do this I receive a convergence error and resulting VaR values of NULL. I tried a few of the suggestions made on her in other threads, including using different solvers, lowering the error tolerance, and using different stock data. Does anyone know why this might be happening?

I am working in R and using the rugarch package, here is the portion of my code where this is done:

spec <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1)), mean.model=list(armaOrder=c(1,1), include.mean = TRUE), distribution="norm")
backtest_forecast <- ugarchroll(spec, returns, n.start = 300, refit.every = 1, refit.window = "moving", VaR.alpha = c(0.01, 0.05), solver.control = list(tol = 1e-6),solver = "nloptr")

The following are some of the errors I am getting:

Warning messages:
1: In .sgarchfit(spec = spec, data = data, out.sample = out.sample,  : 
ugarchfit-->warning: solver failer to converge.
2: In arima(data, order = c(modelinc[2], 0, modelinc[3]), include.mean = modelinc[1],  :
  possible convergence problem: optim gave code = 1

Here is the data I am using:

prices <- getSymbols('AAPL', src = "yahoo", from="2015-01-01", to="2021-01-01",auto.assign = F)[,2]
returns <- diff(log(prices), lag=1)
returns <- na.omit(returns)
  • $\begingroup$ Could you include the output indicating the error? $\endgroup$ – Richard Hardy Apr 22 at 8:37
  • $\begingroup$ @RichardHardy Yes sorry, I have added them to the OP. $\endgroup$ – CBBAM Apr 22 at 8:59
  • 1
    $\begingroup$ That's going to be difficult to answer without the data. You can probably get some result by using resume with solver = "hybrid" (which will try multiple solvers until it doesn't fail), but you might have some deeper underlying problem that should be addressed more directly (e.g. the model is just inappropriate, more so on some specific dates). $\endgroup$ – Chris Haug Apr 22 at 13:21
  • $\begingroup$ @ChrisHaug I tried 3 sets of log return stock data (Apple, Tesla, and GE) as well as using resume/hybrid and run into the same issues. This is strange as I have seen a few blog posts carry this out successfully. Have I coded the model wrong? $\endgroup$ – CBBAM Apr 22 at 18:22
  • $\begingroup$ If this is public data then there's no reason to not post a reproducible code example, including the data. You say "Apple" but we don't know the exact time span or whatever preprocessing steps you've taken that may or may not be wrong. $\endgroup$ – Chris Haug Apr 22 at 19:12

Your Answer

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

Browse other questions tagged or ask your own question.