Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

## Compare GARCH Models Using Likelihood Ratio Test

This example shows how to conduct a likelihood ratio test to choose the number of lags in a GARCH model.

Step 1. Load the data.

Load the Deutschmark/British pound foreign-exchange rate data included with the toolbox. Convert the rates to returns.

```load Data_MarkPound
Y = Data;
r = price2ret(Y);
N = length(r);

figure
plot(r)
xlim([0,N])
title('Mark-Pound Exchange Rate Returns')
```

The daily returns exhibit volatility clustering.

Step 2. Specify and fit a GARCH(1,1) model.

Specify and fit a GARCH(1,1) model (with a mean offset) to the returns series. Return the value of the loglikelihood objective function.

```model1 = garch('Offset',NaN,'GARCHLags',1,'ARCHLags',1);
[fit1,~,LogL1] = estimate(model1,r);
```
```
GARCH(1,1) Conditional Variance Model:
----------------------------------------
Conditional Probability Distribution: Gaussian

Standard          t
Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
Constant    1.07575e-06   3.57246e-07        3.01122
GARCH{1}       0.806055     0.0132741         60.724
ARCH{1}       0.153113     0.0115317        13.2776
Offset   -6.13095e-05   8.28663e-05       -0.73986
```

Step 3. Specify and fit a GARCH(2,1) model.

Specify and fit a GARCH(2,1) model with a mean offset.

```model2 = garch(2,1);
model2.Offset = NaN;
[fit2,~,LogL2] = estimate(model2,r);
```
```
GARCH(2,1) Conditional Variance Model:
----------------------------------------
Conditional Probability Distribution: Gaussian

Standard          t
Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
Constant    1.12165e-06   3.96701e-07        2.82745
GARCH{1}       0.490295      0.106962        4.58381
GARCH{2}       0.297348      0.100325        2.96385
ARCH{1}       0.168074     0.0131723        12.7597
Offset   -4.94928e-05   8.32926e-05      -0.594204
```

Step 4. Conduct a likelihood ratio test.

Conduct a likelihood ratio test to compare the restricted GARCH(1,1) model fit to the unrestricted GARCH(2,1) model fit. The degree of freedom for this test is one (the number of restrictions).

```[h,p] = lratiotest(LogL2,LogL1,1)
```
```h =

1

p =

0.0218

```

At the 0.05 significance level, the null GARCH(1,1) model is rejected (h = 1) in favor of the unrestricted GARCH(2,1) alternative.

## More About

Was this topic helpful?