The RATSletter

# GARCH Models in RATS

### by Rob Trevor

Rob Trevor has been a RATS user since 1987 and is a Professor at Macquarie University in New South Wales, Australia. This article originally appeared in the May, 1994 issue of the RATSLetter.

The usefulness of RATS in estimating GARCH (Generalized AutoRegressive Conditional Heteroscedasticity) models has been greatly improved in v4. The estimation of basic univariate ARCH, ARCH-M and GARCH models is covered on pp 5-31,32 of the User's Manual. In this note we will outline the specification of more complex models. See Bollerslev, Chou and Kroner for a survey.

Specification involves seven steps:

1. use the NONLIN instruction to specify the parameters to be estimated
2. use FRML to specify the conditional mean(s)
3. use FRML to specify the conditional variance(s)
4. use FRML to specify the log likelihood
5. set the initial values of the parameters
6. set the initial values of the residuals and the conditional variance
7. use the MAXIMIZE instruction to compute the estimates.

We will concentrate upon steps 3 and 4. The complete code for these examples, is available in the files GARCHUV.PRG and GARCHMV.PRG (see the Procedures page).

## Univariate Models

A code snippet for a GARCH(1,1) model with a conditionally normal density function is:

```DECLARE SERIES U    ;* Residuals
DECLARE SERIES H    ;* Variances
NONLIN B0 VC VA VB
FRML RESID = Y - B0
FRML HF = VC + VA*H{1} + VB*U{1}**2
FRML LOGL = (H(T)=HF(T)),(U(T)=RESID(T)), -.5*(LOG(H(T)) + U(T)**2/H(T))
LINREG(NOPRINT) Y / U
# CONSTANT
COMPUTE B0=%BETA(1)
COMPUTE VC=%SEESQ,VA=.05,VB=.05
SET H = %SEESQ
MAX(METHOD=BHHH,RECURS,ITERS=100) LOGL start end
```

## Asymmetry

It has long been recognized that equity returns exhibit asymmetrical conditional variance behavior. The EGARCH model (Nelson[1991]) has been used to capture this effect. It may be estimated by adding an additional parameter (VD) to the NONLIN instruction and replacing the definition of HF by:

```FRML G = ABS(U(T)/SQRT(H(T))) - \$
SQRT(2.0/%PI) - VD*U(T)/SQRT(H(T))
FRML HF = EXP(VC + VA*LOG(H{1}) + VB*G{1})
```

An alternative is the GJR (Glosten, etc.) specification:

```FRML HF = VC + VA*H{1} + VB*U{1}**2 + \$
%IF(U{1}<0.0,VD*U{1}**2,0.0)```

## Fat Tails

In many cases the assumption of conditional normality cannot be maintained. Some researchers (Bollerslev[1987]) have preferred a conditional Student-t distribution:

```FRML LOGL = (H(T)=HF(T)),(U(T)=RESID(T)),\$
%LNGAMMA(0.5*(VD+1.0)) - %LNGAMMA(0.5*VD) - \$
0.5*LOG(VD-2) - 0.5*LOG(H(T)) - \$
0.5*(VD+1.0)*LOG(1.0+U(T)**2/(H(T)*(VD-2)))
```

where VD is the `degrees of freedom' parameter.

Alternatively, quasi-Maximum Likelihood estimates may be obtained by using the log likelihood function from the conditional normal specification, and calculating a robust estimate of the covariance of the parameter estimates using the matrix of second derivatives and the average of the period by period outer products of the gradient. The BFGS algorithm with the ROBUSTERRORS option produces the required calculation:

`MAXIMIZE(METHOD=BFGS,ROBUST,RECURSIVE) ...`

Under fairly weak conditions, the resulting estimates are consistent even when the conditional distribution of the residuals is non-normal (see Bollerslev-Wooldridge and Lumsdaine). Actually, the covariance matrix calculated by RATS is not numerically identical to the one referred
to in these papers, but it is asymptotically the same. Similar calculations to those in RATS have been used by others (e.g. McCurdy and Morgan).

## Multivariate Models

These models may be readily extended to a multivariate specification. In the bivariate case, the general `vech' MGARCH specification may be coded:

```NONLIN B11 B21 VC11 VC21 VC31 \$
VA11 VA12 VA13 VA21 VA22 VA23 VA31 VA32 VA33 \$
VB11 VB12 VB13 VB21 VB22 VB23 VB31 VB32 VB33

FRML H11F = (VC=||VC11|VC21|VC31||),\$
(VA=||VA11,VA12,VA13|VA21,VA22,VA23|VA31,VA32,VA33||),\$
(VB=||VB11,VB12,VB13|VB21,VB22,VB23|VB31,VB32,VB33||),\$
([VEC] VECHH=||H11{1},H12{1},H22{1}||),\$
([VEC] VECHU=||U1{1}**2,U1{1}*U2{1},U2{1}**2||),\$
(VECHH=VC + VA * VECHH + VB * VECHU),\$
VECHH(1)

FRML H12F = VECHH(2)
FRML H22F = VECHH(3)

FRML LOGL = \$
H11(T)= H11F(T) ,H22(T)=H22F(T),H12(T)=H12F(T),\$
U1(T) = RESID1(T) , U2(T) = RESID2(T) , \$
H = ||H11(T)|H12(T),H22(T)|| , \$
U = ||U1(T),U2(T)||, \$
%LOGDENSITY(H,U)
*
*  initialize parameters
*  initialize U1,U2,H11,H22,H12
*
MAXIMIZE(METHOD=BHHH,RECURSIVE) LOGL start end
```

This specification has at least two problems:

1. the conditional variance equation has 21 parameters
2. H is not guaranteed to be positive semi-definite.

Consequently, it is usually extremely difficult to obtain satisfactory estimates with this specification.

One way around the first problem is to assume away cross-variance effects by constraining the VA and VB coefficient matrices to be diagonal. The resulting specification has 9 parameters and may be more compactly coded as:

```FRML H11F  = VC11+VA11*H11{1}+VB11*U1{1}**2
FRML H22F  = VC22+VA22*H22{1}+VB22*U2{1}**2
FRML H12F  = VC12+VA12*H12{1}+VB12*U1{1}*U2{1}
```

However, in this multivariate specification it is non-
trivial to ensure that H is positive semi-definite. The constant correlation specification makes this a bit easier. It may be coded by replacing the covariance equation by:

`FRML H12F  = VC12*SQRT(H11(T)*H22(T))`

Neither of these simplifications of the vech specification allow for cross effects in the variance equations. The BEKK (or EK) formulation provides for these parsimoniously, and also guarantees positive semi-definiteness. It may be coded as:

```FRML H11F = (VC=||VC11,VC12|0.0,VC22||),\$
(VA=||VA11,VA12|VA21,VA22||),\$
(VB=||VB11,VB12|VB21,VB22||),\$
(H=||H11{1}|H12{1},H22{1}||),\$
(UB=||U1{1},U2{1}||*VB),\$
(H=TR(VC)*VC+%MQFORM(H,VA)+TR(UB)*UB),\$
H(1,1)
FRML H12F = H(1,2)
FRML H22F = H(2,2)
```

A vast array of other specifications for the dynamics of conditional variance have appeared in the literature. RATS can handle most of them using the techniques illustrated here.

## References:

Bollerslev, T. (1987). "A Conditionally Heteroskedastic Time Series Model for Speculative Prices and Rates of Return." Review of Economics and Statistics.

Bollerslev, T., R. Chou and K. Kroner (1992). "ARCH Modeling in Finance: A Review of the Theory and Empirical Evidence." Journal of Econometrics.

Bollerslev, T. and J.M. Wooldridge(1992). "Quasi-Maximum Likelihood Estimation and Inference in Dynamic Models with Time Varying Covariances." Econometric Reviews

Engle, R.F. and K.F. Kroner(1993). "Multivariate Simultaneous Generalized ARCH." UCSD Working Paper.

Glosten, L., R. Jagannathan and D. Runkle (1993) "On the Relation between the Expected Value and the Volatility of the Nominal Excess Return on Stocks." Journal of Finance.

Lumsdaine, R.L. (1991) "Asymptotic Properties of the Quasi-Maximium Likelihood Estimator in GARCH(1,1) and IGARCH(1,1) Models." Mimeo, Princeton University.

McCurdy, T.H. and I.G. Morgan (1991) "Tests for Systematic Risk Components in Deviations from Uncovered Interest Rate Parity." Review of Economic Studies.

Nelson, D.B. (1991) "Conditional Heteroskedasticity in Asset Returns: A New Approach." Econometrica.