Main Content

Forecast Conditional Mean and Variance Model

This example shows how to forecast responses and conditional variances from a composite conditional mean and variance model.

Step 1. Load the data and fit a model.

Load the NASDAQ data included with the toolbox. Fit a conditional mean and variance model to the data.

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

Mdl = arima('ARLags',1,'Variance',garch(1,1),...
              'Distribution','t');
EstMdl = estimate(Mdl,r,'Variance0',{'Constant0',0.001});
 
    ARIMA(1,0,0) Model (t Distribution):
 
                  Value      StandardError    TStatistic      PValue  
                _________    _____________    __________    __________

    Constant    0.0009512     0.00017067        5.5734      2.4983e-08
    AR{1}         0.13981       0.019066        7.3329      2.2518e-13
    DoF            8.3991         1.0347         8.117      4.7768e-16

 
 
    GARCH(1,1) Conditional Variance Model (t Distribution):
 
                  Value       StandardError    TStatistic      PValue  
                __________    _____________    __________    __________

    Constant    1.6209e-06     6.1682e-07        2.6279       0.0085912
    GARCH{1}       0.89664       0.011218        79.925               0
    ARCH{1}       0.095524       0.010995        8.6877       3.698e-18
    DoF             8.3991         1.0347         8.117      4.7768e-16
[E0,V0] = infer(EstMdl,r);

Step 2. Forecast returns and conditional variances.

Use forecast to compute MMSE forecasts of the returns and conditional variances for a 1000-period future horizon. Use the observed returns and inferred residuals and conditional variances as presample data.

[Y,YMSE,V] = forecast(EstMdl,1000,r,'E0',E0,'V0',V0);
upper = Y + 1.96*sqrt(YMSE);
lower = Y - 1.96*sqrt(YMSE);

figure
subplot(2,1,1)
plot(r,'Color',[.75,.75,.75])
hold on
plot(N+1:N+1000,Y,'r','LineWidth',2)
plot(N+1:N+1000,[upper,lower],'k--','LineWidth',1.5)
xlim([0,N+1000])
title('Forecasted Returns')
hold off
subplot(2,1,2)
plot(V0,'Color',[.75,.75,.75])
hold on
plot(N+1:N+1000,V,'r','LineWidth',2);
xlim([0,N+1000])
title('Forecasted Conditional Variances')
hold off

Figure contains 2 axes objects. Axes object 1 with title Forecasted Returns contains 4 objects of type line. Axes object 2 with title Forecasted Conditional Variances contains 2 objects of type line.

The conditional variance forecasts converge to the asymptotic variance of the GARCH conditional variance model. The forecasted returns converge to the estimated model constant (the unconditional mean of the AR conditional mean model).

See Also

Objects

Functions

Related Topics