[R-SIG-Finance] Just finished Kris Boudt's course, running into errors from non-convergence in rugarch
prof@@mit@mitt@l m@ili@g off gm@il@com
prof@@mit@mitt@l m@ili@g off gm@il@com
Thu Nov 29 05:21:15 CET 2018
End to end examples to extract data objects from results and resolve errors in eric zivot’s presentations on DCC correlations at https://faculty.washington.edu/ezivot/econ589/DCCgarchPowerpoint.pdf
Rmgarch is just rugarch for more than one series at the same time making it richer in functionality. Also make sure input data does not have NAs using na.omit. Also instead of as.data.frame try converting into xts objects as well. Easier with some rugarch extensions. (These two last methods take care of all errors in between)
There is a corresponding one on copulas later also by zivot for his uw advanced econ class
Best regards
Amit
From: R-SIG-Finance <r-sig-finance-bounces using r-project.org> On Behalf Of Ilya Kipnis
Sent: Thursday, November 29, 2018 8:53 AM
To: r-sig-finance using r-project.org
Subject: [R-SIG-Finance] Just finished Kris Boudt's course, running into errors from non-convergence in rugarch
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:
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:
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/20181129/8765e989/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 6511 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20181129/8765e989/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 71728 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20181129/8765e989/attachment-0001.png>
More information about the R-SIG-Finance
mailing list