Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

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

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

alexios
Try setting the solver in the resume command to "gosolnp".
It may also have helped to set fit.control(scale=1) in the ugarchroll,
but you can set this in resume as well.

Alexios

On 11/28/18 7:22 PM, Ilya Kipnis wrote:

> 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.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.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)
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

Ilya Kipnis
image.png

Unfortunately, the gosolnp method does not work. 

Tried implementing fit.control as best I understood it.  

image.png

Also does not work.

On Wed, Nov 28, 2018 at 10:33 PM alexios galanos <[hidden email]> wrote:
Try setting the solver in the resume command to "gosolnp".
It may also have helped to set fit.control(scale=1) in the ugarchroll,
but you can set this in resume as well.

Alexios

On 11/28/18 7:22 PM, Ilya Kipnis wrote:
> 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.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.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)
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

alexios
That's piqued my interest...here is my suggestion (which I have
successfully tested) for a quick solution:

1. Use variance targeting:

gjrSpec <- ugarchspec(mean.model = list(armaOrder =
c(1,0)),variance.model = list(model = "gjrGARCH",
variance.targeting=TRUE),distribution.model = "sstd")

2. remove the NA leftover from the return calculation:
na.omit(spyRets)


Alexios


On 11/28/18 7:39 PM, Ilya Kipnis wrote:

> image.png
>
> Unfortunately, the gosolnp method does not work.
>
> Tried implementing fit.control as best I understood it.
>
> image.png
>
> Also does not work.
>
> On Wed, Nov 28, 2018 at 10:33 PM alexios galanos <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Try setting the solver in the resume command to "gosolnp".
>     It may also have helped to set fit.control(scale=1) in the ugarchroll,
>     but you can set this in resume as well.
>
>     Alexios
>
>     On 11/28/18 7:22 PM, Ilya Kipnis wrote:
>      > 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.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.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)
>      >
>      > _______________________________________________
>      > [hidden email] <mailto:[hidden email]>
>     mailing list
>      > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>      > -- Subscriber-posting only. If you want to post, subscribe first.
>      > -- Also note that this is not the r-help list where general R
>     questions should go.
>      >
>
>     _______________________________________________
>     [hidden email] <mailto:[hidden email]>
>     mailing list
>     https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>     -- Subscriber-posting only. If you want to post, subscribe first.
>     -- Also note that this is not the r-help list where general R
>     questions should go.
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

Ilya Kipnis
The variance.targeting does work, but it does impose an assumption on the
nature of the variance of the S&P 500 returns, that the variance is
naturally mean-reverting, and I'm not sure that's the case. While the VIX
certainly does tend to mean-revert more often than not, the times it
*doesn't* are the times that all of the volatility mean-reverting guys just
get absolutely blown up, whether it's 2008, when vol went up and up, or Feb
4-Feb 5 of 2018, when anyone that thought Feb 5 was a nice time to revert
the Feb 4 spike got blown up in 20 minutes after hours.

Will go with this solution for now in terms of trying to see if there's a
new VIX trading strategy, but I'm hoping I can relax the assumption in the
near future.

Thanks again.

On Wed, Nov 28, 2018 at 10:57 PM alexios galanos <[hidden email]>
wrote:

> That's piqued my interest...here is my suggestion (which I have
> successfully tested) for a quick solution:
>
> 1. Use variance targeting:
>
> gjrSpec <- ugarchspec(mean.model = list(armaOrder =
> c(1,0)),variance.model = list(model = "gjrGARCH",
> variance.targeting=TRUE),distribution.model = "sstd")
>
> 2. remove the NA leftover from the return calculation:
> na.omit(spyRets)
>
>
> Alexios
>
>
> On 11/28/18 7:39 PM, Ilya Kipnis wrote:
> > image.png
> >
> > Unfortunately, the gosolnp method does not work.
> >
> > Tried implementing fit.control as best I understood it.
> >
> > image.png
> >
> > Also does not work.
> >
> > On Wed, Nov 28, 2018 at 10:33 PM alexios galanos <[hidden email]
> > <mailto:[hidden email]>> wrote:
> >
> >     Try setting the solver in the resume command to "gosolnp".
> >     It may also have helped to set fit.control(scale=1) in the
> ugarchroll,
> >     but you can set this in resume as well.
> >
> >     Alexios
> >
> >     On 11/28/18 7:22 PM, Ilya Kipnis wrote:
> >      > 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.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.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)
> >      >
> >      > _______________________________________________
> >      > [hidden email] <mailto:[hidden email]>
> >     mailing list
> >      > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >      > -- Subscriber-posting only. If you want to post, subscribe first.
> >      > -- Also note that this is not the r-help list where general R
> >     questions should go.
> >      >
> >
> >     _______________________________________________
> >     [hidden email] <mailto:[hidden email]>
> >     mailing list
> >     https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >     -- Subscriber-posting only. If you want to post, subscribe first.
> >     -- Also note that this is not the r-help list where general R
> >     questions should go.
> >
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

prof.amit.mittal
In reply to this post by Ilya Kipnis

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 <[hidden email]> On Behalf Of Ilya Kipnis
Sent: Thursday, November 29, 2018 8:53 AM
To: [hidden email]
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:

 

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


_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

prof.amit.mittal
In reply to this post by Ilya Kipnis
Check the rugarch vignettes, it covers each included models with detailed
sub options
Best regards
Amit

-----Original Message-----
From: R-SIG-Finance <[hidden email]> On Behalf Of Ilya
Kipnis
Sent: Thursday, November 29, 2018 9:42 AM
To: Alexios G <[hidden email]>
Cc: [hidden email]
Subject: Re: [R-SIG-Finance] Just finished Kris Boudt's course, running into
errors from non-convergence in rugarch

The variance.targeting does work, but it does impose an assumption on the
nature of the variance of the S&P 500 returns, that the variance is
naturally mean-reverting, and I'm not sure that's the case. While the VIX
certainly does tend to mean-revert more often than not, the times it
*doesn't* are the times that all of the volatility mean-reverting guys just
get absolutely blown up, whether it's 2008, when vol went up and up, or Feb
4-Feb 5 of 2018, when anyone that thought Feb 5 was a nice time to revert
the Feb 4 spike got blown up in 20 minutes after hours.

Will go with this solution for now in terms of trying to see if there's a
new VIX trading strategy, but I'm hoping I can relax the assumption in the
near future.

Thanks again.

On Wed, Nov 28, 2018 at 10:57 PM alexios galanos <[hidden email]>
wrote:

> That's piqued my interest...here is my suggestion (which I have
> successfully tested) for a quick solution:
>
> 1. Use variance targeting:
>
> gjrSpec <- ugarchspec(mean.model = list(armaOrder =
> c(1,0)),variance.model = list(model = "gjrGARCH",
> variance.targeting=TRUE),distribution.model = "sstd")
>
> 2. remove the NA leftover from the return calculation:
> na.omit(spyRets)
>
>
> Alexios
>
>
> On 11/28/18 7:39 PM, Ilya Kipnis wrote:
> > image.png
> >
> > Unfortunately, the gosolnp method does not work.
> >
> > Tried implementing fit.control as best I understood it.
> >
> > image.png
> >
> > Also does not work.
> >
> > On Wed, Nov 28, 2018 at 10:33 PM alexios galanos
> > <[hidden email] <mailto:[hidden email]>> wrote:
> >
> >     Try setting the solver in the resume command to "gosolnp".
> >     It may also have helped to set fit.control(scale=1) in the
> ugarchroll,
> >     but you can set this in resume as well.
> >
> >     Alexios
> >
> >     On 11/28/18 7:22 PM, Ilya Kipnis wrote:
> >      > 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.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.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)
> >      >
> >      > _______________________________________________
> >      > [hidden email] <mailto:[hidden email]>
> >     mailing list
> >      > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >      > -- Subscriber-posting only. If you want to post, subscribe first.
> >      > -- Also note that this is not the r-help list where general R
> >     questions should go.
> >      >
> >
> >     _______________________________________________
> >     [hidden email] <mailto:[hidden email]>
> >     mailing list
> >     https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >     -- Subscriber-posting only. If you want to post, subscribe first.
> >     -- Also note that this is not the r-help list where general R
> >     questions should go.
> >
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions
should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Just finished Kris Boudt's course, running into errors from non-convergence in rugarch

Farid Moussaoui
In reply to this post by Ilya Kipnis

If you look to warnings(), it is said that

Warning in .makefitmodel(garchmodel = "gjrGARCH", f = .gjrgarchLLH, T = T,  :
rugarch-->warning: failed to invert hessian

The 6 available solvers got the same message.
F.

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.