Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Setting the values of one or more parameters for a GARCH model or applying constraints to the range of permissible values can be useful.
The art of the econometrician consists in finding the set of assumptions which are both sufficiently specific and sufficiently realistic to allow him to take the best possible advantage of the data available to him. Edmond Malinvaud, “Statistical Methods of Econometrics”
If you have insight into the values or ranges for specific parameters then you can use the setfixed()
and setbounds()
functions to set these before fitting the model.
Reference Model
Let’s start by creating a reference model using a Standard GARCH model with Skewed Student-t Distribution fore residuals and an AR(1) model for the mean.
specification <- ugarchspec( mean.model = list(armaOrder = c(1, 0)), variance.model = list(model = "sGARCH"), distribution.model = "sstd" ) specification *---------------------------------* * GARCH Model Spec * *---------------------------------* Conditional Variance Dynamics ------------------------------------ GARCH Model : sGARCH(1,1) Variance Targeting : FALSE Conditional Mean Dynamics ------------------------------------ Mean Model : ARFIMA(1,0,0) Include Mean : TRUE GARCH-in-Mean : FALSE Conditional Distribution ------------------------------------ Distribution : sstd Includes Skew : TRUE Includes Shape : TRUE Includes Lambda : FALSE
Fit that to the data and check the coefficients.
fit <- ugarchfit(data = TATASTEEL, spec = specification) Estimate Std. Error t value Pr(>|t|) mu 0.001 0.001 2.500 0.012 ar1 -0.031 0.025 -1.242 0.214 omega 0.000 0.000 1.471 0.141 alpha1 0.038 0.005 7.270 0.000 beta1 0.951 0.007 134.613 0.000 skew 1.045 0.036 28.858 0.000 shape 5.072 0.657 7.721 0.000
Neither of the values for ar1
or omega
appear to be significantly different to zero.
Restricted GARCH: Specified Parameter Values
Let’s test the setfixed()
function. Restrict the model by imposing fixed values for ar1
and omega
.
restricted <- specification setfixed(restricted) <- list(ar1 = 0, omega = 0) restricted *---------------------------------* * GARCH Model Spec * *---------------------------------* Conditional Variance Dynamics ------------------------------------ GARCH Model : sGARCH(1,1) Variance Targeting : FALSE Conditional Mean Dynamics ------------------------------------ Mean Model : ARFIMA(1,0,0) Include Mean : TRUE GARCH-in-Mean : FALSE Conditional Distribution ------------------------------------ Distribution : sstd Includes Skew : TRUE Includes Shape : TRUE Includes Lambda : FALSE
Fit the restricted model.
fit <- ugarchfit(data = TATASTEEL, spec = restricted) Estimate Std. Error t value Pr(>|t|) mu 0.001 0.001 2.242 0.025 ar1 0.000 NA NA NA omega 0.000 NA NA NA alpha1 0.030 0.004 7.257 0.000 beta1 0.969 0.004 237.205 0.000 skew 1.041 0.034 30.432 0.000 shape 5.723 0.717 7.978 0.000
Note that the values for ar1
and omega
are those prescribed but that the remaining parameters have been fit to the data. Since these parameters are not being fit to the data we get neither a \(t\)
nor \(p\)
-value.
Restricted GARCH: Specified Parameter Ranges
Suppose that, rather than specific values, you want to constrain a parameter to values in a particular range.
ranges <- specification setbounds(ranges) <- list(shape = c(10, 100))
That range encompasses the value obtained for shape
in the reference model.
Estimate the bound constrained model.
fit <- ugarchfit(data = TATASTEEL, spec = ranges) coef(fit) NULL
Hmmmm. There are no coefficients? What has gone wrong here?
This is a somewhat subtle problem. The values assigned to the model parameters are obtained by numerical optimisation. The optimisation procedure assumes initial values for the model parameters and then iteratively refines those values until it converges on an optimal solution. Where do those initial values come from? They are chosen empirically as “good” (but also random) values. What has happened here is that the initial value for shape
lies outside the range specified by setbounds()
, so the optimisation algorithm finds that the initial set of parameter values doesn’t satisfy the constraints. And because the initial parameters are invalid it cannot proceed. 💡 The default initial values are generally very good but they can fail when constraints are imposed!
We can fix this by using setstart()
to set an initial value for the shape
parameter that lies within the permitted range.
setstart(ranges) <- list(shape = 50)
This can be done for multiple parameters. Now fit the model and check the coefficients.
fit <- ugarchfit(data = TATASTEEL, spec = ranges) coef(fit) mu ar1 omega alpha1 beta1 1.475421e-03 -2.510039e-02 7.619083e-06 3.601476e-02 9.483590e-01 skew shape 1.039648e+00 1.000000e+01
Aha! Valid parameters. And the value obtained for shape
lies within the specified range.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.