[R-SIG-Finance] Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

Ilya Kipnis ily@@kipni@ @ending from gm@il@com
Thu Nov 29 04:22:40 CET 2018


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.

In the course, it was possible to convert this output into a data frame,
with an as.data.frame command.

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:

[image: image.png]

Here's my MRE:

require(rugarch)
require(quantmod)

# get SPY data from Yahoo (also tried with Quandl, data isn't the issue)
getSymbols("SPY", from = '1990-01-01')

spyRets <- Return.calculate(Ad(SPY))

# GJR garch with AR1 innovations under a skewed student T distribution for
returns
gjrSpec <- ugarchspec(mean.model = list(armaOrder = c(1,0)),
                      variance.model = list(model = "gjrGARCH"),
                      distribution.model = "sstd")

# Use rolling window of 504 days, refitting the model every 22 trading days
t1 <- Sys.time()
garchroll <- ugarchroll(gjrSpec, data = spyRets,
                        n.start = 504, refit.window = "moving",
refit.every = 22)
t2 <- Sys.time()
print(t2-t1)

# try to convert predictions to data frame, as in course -- error thrown
regarding non-converged estimation windows
garchroll <- as.data.frame(garchroll)

With a screenshot for better readability:

[image: image.png]
I also tried the resume command from the following post
https://stat.ethz.ch/pipermail/r-sig-finance/2013q2/011720.html, which did
not solve my problem.

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).

Thank you so much.

Sincerely,

Ilya Kipnis (author of Quantstrat TradeR)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20181128/e647fe88/attachment.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6511 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20181128/e647fe88/attachment.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 49282 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20181128/e647fe88/attachment-0001.png>


More information about the R-SIG-Finance mailing list