<div dir="ltr"><div dir="ltr"><div dir="ltr">I just completed Kris Boudt's datacamp course on GARCH models, and thought I'd give it a spin in a more reasonable setting. I've run into an error that the course didn't cover. I'm using a rolling window of 504 trading days to try to fit a GJR-GARCH with AR1 return innovations and a skewed student t distribution and refitting the model every 22 days (so, basically every month) on SPY returns.  <br><br>In the course, it was possible to convert this output into a data frame, with an as.data.frame command.<br><br>Unfortunately, the course didn't cover what happened when over the course of ~300 model fits, there would be the occasional failure to converge, which throws the following error:<div><br></div><div><div><img src="cid:ii_jp211p770" alt="image.png" width="418" height="61"><br></div></div><div><br>Here's my MRE:<br><br><div>require(rugarch)</div><div>require(quantmod)</div><div><br></div><div># get SPY data from Yahoo (also tried with Quandl, data isn't the issue)</div><div>getSymbols("SPY", from = '1990-01-01')</div><div><br></div><div>spyRets <- Return.calculate(Ad(SPY))</div><div><br></div><div># GJR garch with AR1 innovations under a skewed student T distribution for returns</div><div>gjrSpec <- ugarchspec(mean.model = list(armaOrder = c(1,0)),</div><div>                      variance.model = list(model = "gjrGARCH"),</div><div>                      distribution.model = "sstd")</div><div><br></div><div># Use rolling window of 504 days, refitting the model every 22 trading days</div><div>t1 <- Sys.time()</div><div>garchroll <- ugarchroll(gjrSpec, data = spyRets, </div><div>                        n.start = 504, refit.window = "moving",  refit.every = 22)</div><div>t2 <- Sys.time()</div><div>print(t2-t1)</div><div><br></div><div># try to convert predictions to data frame, as in course -- error thrown regarding non-converged estimation windows</div><div>garchroll <- as.data.frame(garchroll)</div></div><div><br></div><div>With a screenshot for better readability:<br><br><div><img src="cid:ii_jp2155uh1" alt="image.png" width="542" height="205"><br>I also tried the resume command from the following post <a href="https://stat.ethz.ch/pipermail/r-sig-finance/2013q2/011720.html">https://stat.ethz.ch/pipermail/r-sig-finance/2013q2/011720.html</a>, which did not solve my problem.  <br><br>I feel that this is a pretty straightforward application of the rugarch package, and that there is most likely a solution that simply wasn't covered in the course. I'd be greatly appreciative if someone could help me over this hill (albeit at the risk of revealing that I'm not exactly an expert on GARCH models).  <br><br>Thank you so much.</div></div><div><br></div><div>Sincerely,<br><br>Ilya Kipnis (author of Quantstrat TradeR)<br></div></div></div></div>