RATS 10.1
RATS 10.1

Examples /

GARCHUVFLEX.RPF

Home Page

← Previous Next →

GARCHUVFLEX.RPF is an example of estimation of a univariate GARCH model with standard variance recursions, but non-standard densities. This uses specialized versions of procedures for the skew-t and skew-GED distributions (%LOGSKEWTGARCH and %LOGSKEWGEDGARCH).

 

The data used are log returns in the foreign exchange market, using USD/DM. As recommended, these are scaled up by 100.

 

open data garch.asc

data(format=free,org=columns) 1 1867 bp cd dm jy sf

*

set dlogdm = 100*log(dm/dm{1})
 

This first estimates a GARCH(1,1) model with AR(1) and t-distributed errors. (Output).

 

garch(p=1,q=1,reg,distrib=t) / dlogdm

# constant dlogdm{1}

 

And then the same with GED errors (Output)

 

garch(p=1,q=1,reg,distrib=ged) / dlogdm

# constant dlogdm{1}


 

For the non-standard densities, GARCH with the DENSITY and PARMS options is needed. The DENSITY option provides a function which takes the time t variance and residual (both computed using the standard GARCH recursion) and returns the log density conditional on the current values of the parameters in the PARMSET provided by the PARMS option. Those parameters need to be hard coded into the density function, so you need to use those specific names in your PARMSET.

 

The skew-t example uses the %LOGSKEWTGARCH function, which uses %SkewT_eta (degrees of freedom) and %SkewT_lambda (skew parameter) as its shape parameters.
 

nonlin(parmset=skewtparms) %SkewT_eta %SkewT_lambda

compute %SkewT_eta=4.0,%SkewT_lambda=0.0

*

garch(p=1,q=1,reg,density=%logskewtgarch,parms=skewtparms,title="GARCH with Skew-t Errors") / dlogdm

# constant dlogdm{1}

 

(%LOGSKEWTGARCH differs from a standard skew-t by taking the variance of the distribution as an input, rather than the variance of the underlying Normal).

 

You need to provide guess values for the added parameters. 0 is an obvious guess for the skew parameter. For the degrees of freedom, you can either use the shape parameter from a standard GARCH with t errors (roughly 8), or a generic number such as 4.0 which starts with relatively fat tails. (Output).

 

The added parameters follow the standard GARCH parameters. Here, we see a modestly better fit than the standard t, but probably not enough to merit adding the skew parameter.

 

The skew-GED is done with:

 

nonlin(parmset=skewgedparms) %SkewGED_k %SkewGED_lambda

compute %SkewGED_k=2.0,%SkewGED_lambda=0.0

garch(p=1,q=1,reg,density=%logskewgedgarch,parms=skewgedparms,title="GARCH with Skew-GED Errors") / dlogdm

# constant dlogdm{1}

 

Again, you specifically need the %SkewGED_k (shape) and %SkewGED_lambda parameters in the PARMSET. (Output). Again, the improvement by adding the skew effect is fairly modest.

Full Program


 

open data garch.asc
data(format=free,org=columns) 1 1867 bp cd dm jy sf
*
set dlogdm = 100*log(dm/dm{1})
*
* Estimate a GARCH(1,1) with an AR(1) mean model and t errors
*
garch(p=1,q=1,reg,distrib=t) / dlogdm
# constant dlogdm{1}
*
* Same model with GED errors
*
garch(p=1,q=1,reg,distrib=ged) / dlogdm
# constant dlogdm{1}
*
* Estimate with skew-t
*
nonlin(parmset=skewtparms) %SkewT_eta %SkewT_lambda
compute %SkewT_eta=4.0,%SkewT_lambda=0.0
*
garch(p=1,q=1,reg,density=%logskewtgarch,parms=skewtparms,title="GARCH with Skew-t Errors") / dlogdm
# constant dlogdm{1}
*
* Estimate with skew-GED
*
nonlin(parmset=skewgedparms) %SkewGED_k %SkewGED_lambda
compute %SkewGED_k=2.0,%SkewGED_lambda=0.0
garch(p=1,q=1,reg,density=%logskewgedgarch,parms=skewgedparms,title="GARCH with Skew-GED Errors") / dlogdm
# constant dlogdm{1}
 

Output

GARCH Model - Estimation by BFGS

Convergence in    24 Iterations. Final criterion was  0.0000035 <=  0.0000100

 

Dependent Variable DLOGDM

Usable Observations                      1865

Log Likelihood                     -2042.0340
 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                     -0.030838422  0.015499805     -1.98960  0.04663495

2.  DLOGDM{1}                    -0.071768172  0.021682467     -3.30996  0.00093308

 

3.  C                             0.015039017  0.005071571      2.96536  0.00302332

4.  A                             0.104822891  0.017649504      5.93914  0.00000000

5.  B                             0.875418320  0.020043002     43.67701  0.00000000

6.  Shape(t degrees)              8.694472198  1.639620186      5.30274  0.00000011


 

GARCH Model - Estimation by BFGS

Convergence in    31 Iterations. Final criterion was  0.0000000 <=  0.0000100

 

Dependent Variable DLOGDM

Usable Observations                      1865

Log Likelihood                     -2041.3236

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                     -0.032612702  0.014268205     -2.28569  0.02227237

2.  DLOGDM{1}                    -0.072179640  0.024172664     -2.98600  0.00282650

 

3.  C                             0.015380830  0.005237999      2.93639  0.00332052

4.  A                             0.107888070  0.017506453      6.16276  0.00000000

5.  B                             0.871665316  0.019856893     43.89737  0.00000000

6.  Shape(GED)                    1.358239303  0.058488346     23.22239  0.00000000


 

GARCH with Skew-t Errors - Estimation by BFGS

Convergence in    21 Iterations. Final criterion was  0.0000001 <=  0.0000100

 

Dependent Variable DLOGDM

Usable Observations                      1865

Log Likelihood                     -2040.3287

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                     -0.021970386  0.015820809     -1.38870  0.16492345

2.  DLOGDM{1}                    -0.069843518  0.023472531     -2.97554  0.00292471

 

3.  C                             0.016291992  0.005599375      2.90961  0.00361881

4.  A                             0.103875429  0.017664079      5.88060  0.00000000

5.  B                             0.873521972  0.020944632     41.70625  0.00000000

6.  %SKEWT_ETA                    8.782309670  1.712682912      5.12781  0.00000029

7.  %SKEWT_LAMBDA                 0.059554960  0.029848668      1.99523  0.04601779


 

GARCH with Skew-GED Errors - Estimation by BFGS

Convergence in    27 Iterations. Final criterion was  0.0000053 <=  0.0000100

 

Dependent Variable DLOGDM

Usable Observations                      1865

Log Likelihood                     -2038.4773

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                     -0.081188743  0.026649807     -3.04650  0.00231519

2.  DLOGDM{1}                    -0.073545149  0.023741642     -3.09773  0.00195010

 

3.  C                             0.016946203  0.005881049      2.88149  0.00395795

4.  A                             0.105784824  0.018003154      5.87591  0.00000000

5.  B                             0.869585279  0.021511551     40.42411  0.00000000

6.  %SKEWGED_K                    1.474493958  0.068851789     21.41548  0.00000000

7.  %SKEWGED_LAMBDA               0.060025188  0.025790375      2.32743  0.01994260


 


Copyright © 2024 Thomas A. Doan