Documentation Center

  • Trial Software
  • Product Updates

Specify Conditional Mean and Variance Models

This example shows how to specify a composite conditional mean and variance model using arima.

Step 1. Load the data.

Load the NASDAQ data included with the toolbox. Convert the daily close composite index series to a return series.

load Data_EquityIdx
nasdaq = Dataset.NASDAQ;
r = price2ret(nasdaq);
N = length(r);

xlim([0 N])
title('NASDAQ Daily Returns')

The returns appear to exhibit some volatility clustering.

Step 2. Check the series for autocorrelation.

Plot the sample autocorrelation function (ACF) and partial autocorrelation function (PACF) for the return series.


The autocorrelation functions suggests there is significant autocorrelation at lag one.

Step 3. Test the significance of the autocorrelations

Conduct a Ljung-Box Q-test at lag 5.

[h,p] = lbqtest(r,'Lags',5)
h =


p =


The null hypothesis that all autocorrelations are 0 up to lag 5 is rejected (h = 1).

Step 4. Check the series for conditional heteroscedasticity.

Plot the sample ACF and PACF of the squared return series.


The autocorrelation functions show significant serial dependence.

Step 5. Test for significant ARCH effects

Conduct an Engle's ARCH test. Test the null hypothesis of no conditional heteroscedasticity against the alternative hypothesis of an ARCH model with two lags (which is locally equivalent to a GARCH(1,1) model).

[h,p] = archtest(r-mean(r),'lags',2)
h =


p =


The null hypothesis is rejected in favor of the alternative hypothesis (h = 1).

Step 6. Specify a conditional mean and variance model.

Specify an AR(1) model for the conditional mean of the NASDAQ returns, and a GARCH(1,1) model for the conditional variance. This is a model of the form

$${r_t} = c + {\phi _1}{r_{t - 1}} + {\varepsilon _t},$$

where ${\varepsilon _t} = {\sigma _t}{z_t}$ ,

$$\sigma _t^2 = \kappa  + {\gamma _1}\sigma _{t - 1}^2 + {\alpha _1}\varepsilon _{t - 1}^2,$$

and $z_t$ is an independent and identically distributed standardized Gaussian process.

model = arima('ARLags',1,'Variance',garch(1,1))
model = 

    ARIMA(1,0,0) Model:
    Distribution: Name = 'Gaussian'
               P: 1
               D: 0
               Q: 0
        Constant: NaN
              AR: {NaN} at Lags [1]
             SAR: {}
              MA: {}
             SMA: {}
        Variance: [GARCH(1,1) Model]

The model output shows that a garch model is stored in the Variance property of the arima model, model.

See Also

| | | | |

Related Examples

More About

Was this topic helpful?