Quantcast

RUGARCH rolling forecast using external regressors

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RUGARCH rolling forecast using external regressors

stoyan.stoyanov
Hi there,

First of all, thanks for an amazing package! This is cutting edge and it really does wonders.
3 questions:
1. I am using the rugarch package to fit a TARCH model to high frequency single stock returns data (2000 obs in the example below), and forecast conditional variance. Everything works fine until the moment when I try to do a rolling forecast using external regressors. Examples of regressors I have tried are implied volatility and an earnings event dummy variable. I noticed that someone else on the forum had a similar issue and was wondering whether there might be a glitch in the package or am I doing something wrong…
Below are the relevant parts of the code, sample dataset and error message. Hope someone can help!

2. I am not convinced whether the fact that my TARCH alpha, beta and eta coefficients sum up to more than 1 means that I could get a non-stationary process. I know that with GARCH the coefficients sum should be restricted to <= 1 but am confused when it comes to the eta coefficient. (fit output at the bottom)

3. What exactly does variance targeting do. (Feel free to ignore this question)
Thank you in advance.

#Code
spec<-ugarchspec(variance.model = list(model = "fGARCH", garchOrder = c(1,1),
                        submodel = "TGARCH", external.regressors = regressors, variance.targeting = TRUE),
                 mean.model = list (armaOrder = c(1,1), include.mean = TRUE, archm = FALSE,
                        archpow = 1, arfima = FALSE, external.regressors = NULL, archex = FALSE),
                 distribution.model = "std", start.pars = list(), fixed.pars = list())

fit<-ugarchfit(spec, data, out.sample = 0, solver = "solnp", solver.control = list(),
               fit.control = list(stationarity = 1, fixed.se = 0, scale = 0))

roll=ugarchroll(spec, data, n.ahead = 1, forecast.length = 200, refit.every = 25,
           refit.window = "moving", parallel = FALSE,
           parallel.control = list(pkg = c("multicore", "snowfall"), cores = 2), solver = "solnp",
           fit.control = list(), solver.control = list(), calculate.VaR = TRUE,
           VaR.alpha = c(0.01, 0.05))

#Error message
...estimating refit windows...

Done!...all converged.
Error in fmexdata[[i]] : subscript out of bounds

#Again, my suspicion is that the rolling forecast function messes up because of the external regressors. It works perfectly fine without them...

*---------------------------------*
*          GARCH Model Fit        *
*---------------------------------*

Conditional Variance Dynamics
-----------------------------------
GARCH Model : fGARCH(1,1)
fGARCH Sub-Model : TGARCH
Mean Model : ARFIMA(1,0,1)
Distribution : std

Optimal Parameters
------------------------------------
        Estimate  Std. Error   t value Pr(>|t|)
mu      0.000015    0.000002   7.59458   0.0000
ar1     0.183552    0.008229  22.30584   0.0000
ma1    -0.223085    0.008187 -27.24730   0.0000
alpha1  0.079457    0.003750  21.18601   0.0000
beta1   0.931504    0.003484 267.37350   0.0000
eta11   0.030469    0.005535   5.50526   0.0000
vxreg1  0.000000    0.000007   0.00226   0.9982
shape   6.453012    0.280138  23.03508   0.0000
omega   0.000002          NA        NA       NA

Robust Standard Errors:
        Estimate  Std. Error    t value Pr(>|t|)
mu      0.000015    0.000003   4.317851 0.000016
ar1     0.183552    0.023880   7.686537 0.000000
ma1    -0.223085    0.023552  -9.472028 0.000000
alpha1  0.079457    0.005819  13.654150 0.000000
beta1   0.931504    0.005007 186.045420 0.000000
eta11   0.030469    0.003464   8.796946 0.000000
vxreg1  0.000000    0.000010   0.001628 0.998701
shape   6.453012    0.360340  17.908115 0.000000
omega   0.000002          NA         NA       NA

LogLikelihood : 127062.8

regressors.csv
data.csv
Stoyan Stoyanov
The University of Chicago Booth School of Business
MBA Class of 2013
(312) 532-0120 | stoyanov@chicagobooth.edu
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: RUGARCH rolling forecast using external regressors

stoyan.stoyanov
Make that 19220 obs.
Stoyan Stoyanov
The University of Chicago Booth School of Business
MBA Class of 2013
(312) 532-0120 | stoyanov@chicagobooth.edu
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: RUGARCH rolling forecast using external regressors

alexios
In reply to this post by stoyan.stoyanov
Hi Stoyan,

1. Yes, that was definitely a bug, thanks for reporting. I have uploaded
a fix to R-Forge (rev.423)...should be available to download in the next
check/build.

2. Use the  "persistence" method on the fitted object:
 >persistence(fit)
persistence
    0.991474
The TARCH model persistence is NOT \alpha+\beta+\eta. See the vignette
for the details (from the fGARCH model equation on persistence). Note
that in all models of the rugarch package, the persistence constraint is
turned ON by default (via the fit.control option).

3. Again, please read the vignette which clearly explains variance
targeting (e.g. see page 6 equation 10 and the reference to the Engle
and Mezrich (1995) paper on page 5).


HTH.

Regards,

Alexios


On 22/06/2012 15:02, stoyan.stoyanov wrote:

> Hi there,
>
> First of all, thanks for an amazing package! This is cutting edge and it
> really does wonders.
> *3 questions:*
> 1. I am using the rugarch package to fit a TARCH model to high frequency
> single stock returns data (2000 obs in the example below), and forecast
> conditional variance. Everything works fine until the moment when I try to
> do a rolling forecast using external regressors. Examples of regressors I
> have tried are implied volatility and an earnings event dummy variable. I
> noticed that someone else on the forum had a similar issue and was wondering
> whether there might be a glitch in the package or am I doing something
> wrong…
> Below are the relevant parts of the code, sample dataset and error message.
> Hope someone can help!
>
> 2. I am not convinced whether the fact that my TARCH alpha, beta and eta
> coefficients sum up to more than 1 means that I could get a non-stationary
> process. I know that with GARCH the coefficients sum should be restricted to
> <= 1 but am confused when it comes to the eta coefficient. (fit output at
> the bottom)
>
> 3. What exactly does variance targeting do. (Feel free to ignore this
> question)
> Thank you in advance.
>
> *#Code *
> spec<-ugarchspec(variance.model = list(model = "fGARCH", garchOrder =
> c(1,1),
>                          submodel = "TGARCH", external.regressors =
> regressors, variance.targeting = TRUE),
>                   mean.model = list (armaOrder = c(1,1), include.mean = TRUE,
> archm = FALSE,
>                          archpow = 1, arfima = FALSE, external.regressors =
> NULL, archex = FALSE),
>                   distribution.model = "std", start.pars = list(), fixed.pars
> = list())
>
> fit<-ugarchfit(spec, data, out.sample = 0, solver = "solnp", solver.control
> = list(),
>                 fit.control = list(stationarity = 1, fixed.se = 0, scale =
> 0))
>
> roll=ugarchroll(spec, data, n.ahead = 1, forecast.length = 200, refit.every
> = 25,
>             refit.window = "moving", parallel = FALSE,
>             parallel.control = list(pkg = c("multicore", "snowfall"), cores =
> 2), solver = "solnp",
>             fit.control = list(), solver.control = list(), calculate.VaR =
> TRUE,
>             VaR.alpha = c(0.01, 0.05))
>
> *#Error message*
> ...estimating refit windows...
>
> Done!...all converged.
> Error in fmexdata[[i]] : subscript out of bounds
>
> #Again, my suspicion is that the rolling forecast function messes up because
> of the external regressors. It works perfectly fine without them...
>
> *---------------------------------*
> *          GARCH Model Fit        *
> *---------------------------------*
>
> Conditional Variance Dynamics
> -----------------------------------
> GARCH Model : fGARCH(1,1)
> fGARCH Sub-Model : TGARCH
> Mean Model : ARFIMA(1,0,1)
> Distribution : std
>
> Optimal Parameters
> ------------------------------------
>          Estimate  Std. Error   t value Pr(>|t|)
> mu      0.000015    0.000002   7.59458   0.0000
> ar1     0.183552    0.008229  22.30584   0.0000
> ma1    -0.223085    0.008187 -27.24730   0.0000
> alpha1  0.079457    0.003750  21.18601   0.0000
> beta1   0.931504    0.003484 267.37350   0.0000
> eta11   0.030469    0.005535   5.50526   0.0000
> vxreg1  0.000000    0.000007   0.00226   0.9982
> shape   6.453012    0.280138  23.03508   0.0000
> omega   0.000002          NA        NA       NA
>
> Robust Standard Errors:
>          Estimate  Std. Error    t value Pr(>|t|)
> mu      0.000015    0.000003   4.317851 0.000016
> ar1     0.183552    0.023880   7.686537 0.000000
> ma1    -0.223085    0.023552  -9.472028 0.000000
> alpha1  0.079457    0.005819  13.654150 0.000000
> beta1   0.931504    0.005007 186.045420 0.000000
> eta11   0.030469    0.003464   8.796946 0.000000
> vxreg1  0.000000    0.000010   0.001628 0.998701
> shape   6.453012    0.360340  17.908115 0.000000
> omega   0.000002          NA         NA       NA
>
> LogLikelihood : 127062.8
>
> http://r.789695.n4.nabble.com/file/n4634210/regressors.csv regressors.csv
> http://r.789695.n4.nabble.com/file/n4634210/data.csv data.csv
>
> --
> View this message in context: http://r.789695.n4.nabble.com/RUGARCH-rolling-forecast-using-external-regressors-tp4634210.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> [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
|  
Report Content as Inappropriate
star

Re: RUGARCH rolling forecast using external regressors

Wildi Marc (wlmr)
In reply to this post by stoyan.stoyanov
Off topic but nevertheless potentially useful: Look at your ARMA model parameters: AR and MA cancel on both sides of the equation. Typically t-tests (variances) are totally spurious in such a case. Try a white noise model: forecasts will look less sexy but it's likely that they'll be more accurate (in a mean-square perspective).

Marc

________________________________________
Von: [hidden email] [[hidden email]]&quot; im Auftrag von &quot;stoyan.stoyanov [[hidden email]]
Gesendet: Freitag, 22. Juni 2012 16:02
An: [hidden email]
Betreff: [R-SIG-Finance] RUGARCH rolling forecast using external regressors

Hi there,

First of all, thanks for an amazing package! This is cutting edge and it
really does wonders.
*3 questions:*
1. I am using the rugarch package to fit a TARCH model to high frequency
single stock returns data (2000 obs in the example below), and forecast
conditional variance. Everything works fine until the moment when I try to
do a rolling forecast using external regressors. Examples of regressors I
have tried are implied volatility and an earnings event dummy variable. I
noticed that someone else on the forum had a similar issue and was wondering
whether there might be a glitch in the package or am I doing something
wrong…
Below are the relevant parts of the code, sample dataset and error message.
Hope someone can help!

2. I am not convinced whether the fact that my TARCH alpha, beta and eta
coefficients sum up to more than 1 means that I could get a non-stationary
process. I know that with GARCH the coefficients sum should be restricted to
<= 1 but am confused when it comes to the eta coefficient. (fit output at
the bottom)

3. What exactly does variance targeting do. (Feel free to ignore this
question)
Thank you in advance.

*#Code *
spec<-ugarchspec(variance.model = list(model = "fGARCH", garchOrder =
c(1,1),
                        submodel = "TGARCH", external.regressors =
regressors, variance.targeting = TRUE),
                 mean.model = list (armaOrder = c(1,1), include.mean = TRUE,
archm = FALSE,
                        archpow = 1, arfima = FALSE, external.regressors =
NULL, archex = FALSE),
                 distribution.model = "std", start.pars = list(), fixed.pars
= list())

fit<-ugarchfit(spec, data, out.sample = 0, solver = "solnp", solver.control
= list(),
               fit.control = list(stationarity = 1, fixed.se = 0, scale =
0))

roll=ugarchroll(spec, data, n.ahead = 1, forecast.length = 200, refit.every
= 25,
           refit.window = "moving", parallel = FALSE,
           parallel.control = list(pkg = c("multicore", "snowfall"), cores =
2), solver = "solnp",
           fit.control = list(), solver.control = list(), calculate.VaR =
TRUE,
           VaR.alpha = c(0.01, 0.05))

*#Error message*
...estimating refit windows...

Done!...all converged.
Error in fmexdata[[i]] : subscript out of bounds

#Again, my suspicion is that the rolling forecast function messes up because
of the external regressors. It works perfectly fine without them...

*---------------------------------*
*          GARCH Model Fit        *
*---------------------------------*

Conditional Variance Dynamics
-----------------------------------
GARCH Model     : fGARCH(1,1)
fGARCH Sub-Model        : TGARCH
Mean Model      : ARFIMA(1,0,1)
Distribution    : std

Optimal Parameters
------------------------------------
        Estimate  Std. Error   t value Pr(>|t|)
mu      0.000015    0.000002   7.59458   0.0000
ar1     0.183552    0.008229  22.30584   0.0000
ma1    -0.223085    0.008187 -27.24730   0.0000
alpha1  0.079457    0.003750  21.18601   0.0000
beta1   0.931504    0.003484 267.37350   0.0000
eta11   0.030469    0.005535   5.50526   0.0000
vxreg1  0.000000    0.000007   0.00226   0.9982
shape   6.453012    0.280138  23.03508   0.0000
omega   0.000002          NA        NA       NA

Robust Standard Errors:
        Estimate  Std. Error    t value Pr(>|t|)
mu      0.000015    0.000003   4.317851 0.000016
ar1     0.183552    0.023880   7.686537 0.000000
ma1    -0.223085    0.023552  -9.472028 0.000000
alpha1  0.079457    0.005819  13.654150 0.000000
beta1   0.931504    0.005007 186.045420 0.000000
eta11   0.030469    0.003464   8.796946 0.000000
vxreg1  0.000000    0.000010   0.001628 0.998701
shape   6.453012    0.360340  17.908115 0.000000
omega   0.000002          NA         NA       NA

LogLikelihood : 127062.8

http://r.789695.n4.nabble.com/file/n4634210/regressors.csv regressors.csv
http://r.789695.n4.nabble.com/file/n4634210/data.csv data.csv

--
View this message in context: http://r.789695.n4.nabble.com/RUGARCH-rolling-forecast-using-external-regressors-tp4634210.html
Sent from the Rmetrics mailing list archive at Nabble.com.

_______________________________________________
[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
|  
Report Content as Inappropriate
star

Re: RUGARCH rolling forecast using external regressors

stoyan.stoyanov
In reply to this post by stoyan.stoyanov
Thank you both for the quick replies. Much appreciated.

Stoyan
Stoyan Stoyanov
The University of Chicago Booth School of Business
MBA Class of 2013
(312) 532-0120 | stoyanov@chicagobooth.edu
Loading...