RATS 10.1
RATS 10.1

While the GARCH instruction can handle a wide range of standard GARCH models, there will always be recent refinements which don’t fit into its framework. In most cases, these can be estimated using MAXIMIZE by making adaptations to one of a few basic models. We’ve found that it’s easiest to do this if the key parts of the log likelihood are computed by separate FRMLs. Thus, there are seven steps used in specifying ARCH, GARCH, and like models in RATS:

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 using the mean and variance formulas

5.set the initial values of the parameters

6.set the pre-sample values of the residuals and the conditional variance

7.use the MAXIMIZE instruction to compute the estimates.

 

Using separate PARMSETs for the mean and variance models is also a good practice.

 

The following program segment implements a GARCH(1,1) model, with a variance function of the standard \(h_t  = c + au_{t - 1}^2  + bh_{t - 1} \). The values for the residuals, the squared residuals and the variances are generated (recursively) and saved into the series U, UU and H. H is generated first to allow for the possibility that your mean model depends upon its current value. The contents of these series will change with each function evaluation. The use of the UU series simplifies some of the calculations, since the model is generating its expected value. This, along with many other variants on GARCH models, are demonstrated on the example file GARCHUVMAX.RPF.

 

It’s important to note that when you use MAXIMIZE, you must provide an explicit start for the estimation range. Because of the recursive nature of the calculation, MAXIMIZE can’t easily figure out which entry is the first one computable. In this case, the first entry is 3, allowing for one lag due to the AR(1), and another because the input series was generated as a log first difference.

 

linreg dlogdm

# constant dlogdm{1}

 

Steps 2,  1 (for the mean), 5 (for the mean)

 

frml(lastreg,vector=beta) meanf

nonlin(parmset=meanparms) beta

 

Step 5

 

set uu = %seesq

set h  = %seesq

set u  = 0.0

 

Step 1 (for the variance model)

 

nonlin(parmset=garchparms) c a b

 

Step 5 (for the variance model). This assumes a moderately high degree of persistence (mainly in the "GARCH" term) and backs ouit the variance intercept to give an unconditional variance equal to the variance estimate from the linear regression.

 

compute a=.05,b=.75,c=%seesq*(1-a-b)

 

Step 3

 

frml varf = c+a*uu{1}+b*h{1}

 

Step 4

 

frml logl = (h(t)=varf(t)),(u(t)=dlogdm-meanf),(uu(t)=u^2),%logdensity(h,u)

 

Step 7

 

maximize(parmset=meanparms+garchparms) logl 3 *

 

Troubleshooting

If you try to estimate a GARCH model using MAXIMIZE and get the error message:

 

Missing Values And/Or SMPL Option Leave No Usable Data Points

 

your estimation range probably starts too soon for your data. Check the range of your data and adjust the MAXIMIZE instruction appropriately. If you still have problems, you can test the settings of your formulas with (for instance),

 

set testlog start end = logl(t)

print start end testlog u h

 

where start and end are the starting and ending dates you want to use for your estimation. See if the printed values make sense. If you see NA’s (missing values) in some or all of the series, work your way back and check the calculations in question to find where they’re failing. In a GARCH model, once there’s a single bad data point, all later time periods will also be dropped since the variance term isn’t computable.

 

If the MAXIMIZE seems to work, but you’re losing observations unexpectedly, do the combination of SET and PRINT above. Check your data to make sure there isn’t a missing value. If nothing turns up, do the same thing before the MAXIMIZE (right after setting your initial guess values). RATS will throw out any data points which produce NA’s given the initial parameter settings. So, if you see NA’s in the output, you may need to change your initial values.

 

The GARCH model has one numerical problem not shared by ARCH. It is possible for the variance to “explode” for certain values of the parameters. In estimating the unknown parameters, RATS may examine some of these bad values with uncertain consequences. We have two suggestions for dealing with this:

1.Use PMETHOD=SIMPLEX for a small number of preliminary iterations to (in effect) improve your initial estimates. Then use BFGS or BHHH as your main estimation method.

2.Replace the VARF formula with the following, which forces an NA value if the variance gets near an overflow:

          frml varf = c + a*uu{1} + b*%ovcheck(h{1})


Copyright © 2025 Thomas A. Doan