Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

## Estimate Conditional Mean and Variance Models

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

Step 1. Load the data and specify the model.

Load the NASDAQ data included with the toolbox. Convert the daily close composite index series to a return series. Specify an AR(1) and GARCH(1,1) composite model. This is a model of the form

where ,

and is an independent and identically distributed standardized Gaussian process.

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

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]


Step 2. Estimate the model parameters without using presample data.

Fit the model object, model, to the return series, r, using estimate. Use the presample observations that estimate automatically generates.

fit = estimate(model,r);


ARIMA(1,0,0) Model:
--------------------
Conditional Probability Distribution: Gaussian

Standard          t
Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
Constant    0.000716654   0.000179112        4.00116
AR{1}       0.137371     0.0198323        6.92662

GARCH(1,1) Conditional Variance Model:
----------------------------------------
Conditional Probability Distribution: Gaussian

Standard          t
Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
Constant    2.32077e-06   5.39077e-07        4.30508
GARCH{1}        0.86984    0.00918896        94.6614
ARCH{1}       0.121008    0.00856049        14.1357


The estimation display shows the five estimated parameters and their corresponding standard errors (the AR(1) conditional mean model has two parameters, and the GARCH(1,1) conditional variance model has three parameters).

The fitted model is

where and

All t statistics are greater than two, suggesting all parameters are statistically significant.

Step 3. Infer the conditional variances and residuals.

Infer and plot the conditional variances and standardized residuals. Also output the loglikelihood objective function value.

[res,V,LogL] = infer(fit,r);

figure
subplot(2,1,1)
plot(V)
xlim([0,N])
title('Conditional Variance')

subplot(2,1,2)
plot(res./sqrt(V))
xlim([0,N])
title('Standardized Residuals')


The conditional variances increase after observation 2000. This corresponds to the increased volatility seen in the original return series.

The standardized residuals have more large values (larger than 2 or 3 in absolute value) than expected under a standard normal distribution. This suggests a Student's t distribution might be more appropriate for the innovation distribution.

Step 4. Fit a model with a t innovation distribution.

Modify the model object so that it has a Student's t innovation distribution. Fit the modified model to the NASDAQ return series. Specify an initial value for the variance model constant term.

model.Distribution = 't';
fitT = estimate(model,r,'Variance0',{'Constant0',0.001});


ARIMA(1,0,0) Model:
--------------------
Conditional Probability Distribution: t

Standard          t
Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
Constant     0.00101311   0.000169312        5.98369
AR{1}       0.144242     0.0191209        7.54367
DoF        7.46985      0.906287        8.24226

GARCH(1,1) Conditional Variance Model:
----------------------------------------
Conditional Probability Distribution: t

Standard          t
Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
Constant    1.55553e-06   6.30827e-07        2.46586
GARCH{1}       0.895386     0.0115454        77.5534
ARCH{1}       0.100264     0.0118127        8.48783
DoF        7.46985      0.906287        8.24226


The coefficient estimates change slightly when the t distribution is used for the innovations. The second model fit has one additional parameter estimate, the t distribution degrees of freedom. The estimated degrees of freedom are relatively small (about 8), indicating significant departure from normality.

Step 5. Compare the model fits.

Compare the two model fits (Gaussian and innovation distribution) using the Akaike information criterion (AIC) and Bayesian information criterion (BIC). First, obtain the loglikelihood objective function value for the second fit.

[resT,VT,LogLT] = infer(fitT,r);
[aic,bic] = aicbic([LogL,LogLT],[5,6],N)

aic =

1.0e+04 *

-1.8387   -1.8498

bic =

1.0e+04 *

-1.8357   -1.8462



The second model has six parameters compared to five in the first model (because of the t distribution degrees of freedom). Despite this, both information criteria favor the model with the Student's t distribution. The AIC and BIC values are smaller (more negative) for the t innovation distribution.