# Documentation

## 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.

Load the Deutschmark/British pound foreign-exchange rate data included with the toolbox. Convert the daily 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. Large changes in the returns tend to cluster together, and small changes tend to cluster together. That is, the series exhibits conditional heteroscedasticity.

The returns are of relatively high frequency. Therefore, the daily changes can be small. For numerical stability, it is good practice to scale such data. In this case, scale the returns to percentage returns.

```r = 100*r; ```

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 0.0107613 0.00132297 8.13424 GARCH{1} 0.805974 0.0165603 48.669 ARCH{1} 0.153134 0.0139737 10.9587 Offset -0.00619042 0.00843359 -0.73402 ```

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 0.0112262 0.001538 7.29921 GARCH{1} 0.489644 0.111593 4.38776 GARCH{2} 0.297688 0.102181 2.91333 ARCH{1} 0.168419 0.0165832 10.156 Offset -0.0049837 0.00847645 -0.587947 ```

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.