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

.

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

load Data_EquityIdx nasdaq = DataTable.NASDAQ; r = 100*price2ret(nasdaq); T = length(r); figure plot(r) xlim([0 T]) title('NASDAQ Daily Returns')

The returns appear to fluctuate around a constant level, but 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.

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

figure subplot(2,1,1) autocorr(r) subplot(2,1,2) parcorr(r)

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

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

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

h = 1 p = 0.0120

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

).

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

figure subplot(2,1,1) autocorr(r.^2) subplot(2,1,2) parcorr(r.^2)

The autocorrelation functions show significant serial dependence, which suggests that the series is conditionally heteroscedastic.

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 = 1 p = 0

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

).

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

where ,

and is an independent and identically distributed standardized Gaussian process.

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

Mdl = 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, `Mdl`

.

`archtest`

| `arima`

| `autocorr`

| `garch`

| `lbqtest`

| `parcorr`

- Estimate Conditional Mean and Variance Models
- Simulate Conditional Mean and Variance Models
- Forecast Conditional Mean and Variance Model

Was this topic helpful?