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);

model = arima('ARLags',1,'Variance',garch(1,1),...
              'Distribution','t');
fit = estimate(model,r,'Variance0',{'Constant0',0.001});
[E0,V0] = infer(fit,r);
 
    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

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(fit,1000,'Y0',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

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

| | | |

Related Examples

More About

Was this topic helpful?