Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

forecast

Forecast conditional variances from conditional variance models

Syntax

  • V = forecast(Mdl,numPeriods)
    example
  • V = forecast(Mdl,numPeriods,Name,Value)
    example

Description

example

V = forecast(Mdl,numPeriods) forecasts conditional variances of the fully specified, univariate conditional variance model Mdl over the forecast horizon numPeriods. Mdl can be a garch, egarch, or gjr model.

example

V = forecast(Mdl,numPeriods,Name,Value) generates forecasts with additional options specified by one or more Name,Value pair arguments. For example, you can specify presample responses or conditional variances.

Examples

collapse all

Forecast the conditional variance of simulated data over a 30-period horizon.

Simulate 100 observations from a GARCH(1,1) model with known parameters.

Mdl = garch('Constant',0.02,'GARCH',0.8,'ARCH',0.1);
rng default; % For reproducibility
[v,y] = simulate(Mdl,100);

Forecast the conditional variances over a 30-period horizon, with and without using the simulated data as presample innovations. Plot the forecasts.

vF1 = forecast(Mdl,30,'Y0',y);
vF2 = forecast(Mdl,30);

figure
plot(v,'Color',[.7,.7,.7])
hold on
plot(101:130,vF1,'r','LineWidth',2);
plot(101:130,vF2,':','LineWidth',2);
title('Forecasted Conditional Variances')
legend('Observed','Forecasts with Presamples',...
		'Forecasts without Presamples','Location','NorthEast')
hold off

Forecasts made without using presample innovations equal the unconditional innovation variance. Forecasts made using presample innovations converge asymptotically to the unconditional innovation variance.

Forecast the conditional variance of simulated data over a 30-period horizon.

Simulate 100 observations from an EGARCH(1,1) model with known parameters.

Mdl = egarch('Constant',0.01,'GARCH',0.6,'ARCH',0.2,...
            'Leverage',-0.2);
rng default; % For reproducibility
[v,y] = simulate(Mdl,100);

Forecast the conditional variance over a 30-period horizon, with and without using the simulated data as presample innovations. Plot the forecasts.

Vf1 = forecast(Mdl,30,'Y0',y);
Vf2 = forecast(Mdl,30);

figure
plot(v,'Color',[.7,.7,.7])
hold on
plot(101:130,Vf1,'r','LineWidth',2);
plot(101:130,Vf2,':','LineWidth',2);
title('Forecasted Conditional Variances')
legend('Observed','Forecasts with Presamples',...
		'Forecasts without Presamples','Location','NorthEast')
hold off

Forecasts made without using presample innovations equal the unconditional innovation variance. Forecasts made using presample innovations converge asymptotically to the unconditional innovation variance.

Forecast the conditional variance of simulated data over a 30-period horizon.

Simulate 100 observations from a GJR(1,1) model with known parameters.

Mdl = gjr('Constant',0.01,'GARCH',0.6,'ARCH',0.2,...
    'Leverage',0.2);
rng default; % For reproducibility
[v,y] = simulate(Mdl,100);

Forecast the conditional variances over a 30-period horizon, with and without using the simulated data as presample innovations. Plot the forecasts.

vF1 = forecast(Mdl,30,'Y0',y);
vF2 = forecast(Mdl,30);

figure
plot(v,'Color',[.7,.7,.7])
hold on
plot(101:130,vF1,'r','LineWidth',2);
plot(101:130,vF2,':','LineWidth',2);
title('Forecasted Conditional Variances')
legend('Observed','Forecasts with Presamples',...
		'Forecasts without Presamples','Location','NorthEast')
hold off

Forecasts made without using presample innovations equal the unconditional innovation variance. Forecasts made using presample innovations converge asymptotically to the unconditional innovation variance.

Forecast the conditional variance of the NASDAQ Composite Index returns over a 500-day horizon using GARCH(1,1), EGARCH(1,1) and GJR(1,1) models.

Load the NASDAQ data included with the toolbox. Convert the index to returns. Plot the returns.

load Data_EquityIdx
nasdaq = DataTable.NASDAQ;
r = price2ret(nasdaq);
T = length(r);
meanR = mean(r)

figure;
plot(dates(2:end),r,dates(2:end),meanR*ones(T,1),'--r');
datetick;
title('Daily NASDAQ Returns');
xlabel('Day');
ylabel('Return');
meanR =

   4.7771e-04

The variance of the series seems to change. This change is an indication of volatility clustering. The conditional mean model offset is very close to zero.

Fit GARCH(1,1), EGARCH(1,1), and GJR(1,1) models to the data. By default, the software sets the conditional mean model offset to zero.

MdlGARCH = garch(1,1);
MdlEGARCH = egarch(1,1);
MdlGJR = gjr(1,1);

EstMdlGARCH = estimate(MdlGARCH,r);
EstMdlEGARCH = estimate(MdlEGARCH,r);
EstMdlGJR = estimate(MdlGJR,r);
 
    GARCH(1,1) Conditional Variance Model:
    ----------------------------------------
    Conditional Probability Distribution: Gaussian

                                  Standard          t     
     Parameter       Value          Error       Statistic 
    -----------   -----------   ------------   -----------
     Constant    2.01007e-06   5.43139e-07        3.70083
     GARCH{1}       0.883295    0.00845281        104.497
      ARCH{1}       0.109193    0.00766205        14.2511
 
    EGARCH(1,1) Conditional Variance Model:
    --------------------------------------
    Conditional Probability Distribution: Gaussian

                                  Standard          t     
     Parameter       Value          Error       Statistic 
    -----------   -----------   ------------   -----------
     Constant      -0.134943     0.0220956       -6.10726
     GARCH{1}       0.983893     0.0024225        406.148
      ARCH{1}       0.199641     0.0139637        14.2971
  Leverage{1}     -0.0602423    0.00564597         -10.67
 
    GJR(1,1) Conditional Variance Model:
    --------------------------------------
    Conditional Probability Distribution: Gaussian

                                  Standard          t     
     Parameter       Value          Error       Statistic 
    -----------   -----------   ------------   -----------
     Constant    2.45679e-06   5.68288e-07        4.32314
     GARCH{1}       0.881436    0.00947814        92.9967
      ARCH{1}      0.0639409     0.0091772        6.96737
  Leverage{1}      0.0889089     0.0099026        8.97834

Forecast the conditional variance for 500 days using the fitted models. Use the observed returns as presample innovations for the forecasts.

vFGARCH = forecast(EstMdlGARCH,500,'Y0',r);
vFEGARCH = forecast(EstMdlEGARCH,500,'Y0',r);
vFGJR= forecast(EstMdlGJR,500,'Y0',r);

Plot the forecasts along with the conditional variances inferred from the data.

vGARCH = infer(EstMdlGARCH,r);
vEGARCH = infer(EstMdlEGARCH,r);
vGJR = infer(EstMdlGJR,r);
datesFH = dates(end):(dates(end)+1000); % 1000 period forecast horizon

figure;
subplot(3,1,1);
plot(dates(end-250:end),vGARCH(end-250:end),'b',...
    datesFH(2:end-500),vFGARCH,'b--');
legend('Inferred','Forecast','Location','NorthEast');
title('GARCH(1,1) Conditional Variances');
datetick;
axis tight;
subplot(3,1,2);
plot(dates(end-250:end),vEGARCH(end-250:end),'r',...
    datesFH(2:end-500),vFEGARCH,'r--');
legend('Inferred','Forecast','Location','NorthEast');
title('EGARCH(1,1) Conditional Variances');
datetick;
axis tight;

subplot(3,1,3);
plot(dates(end-250:end),vGJR(end-250:end),'k',...
    datesFH(2:end-500),vFGJR,'k--');
legend('Inferred','Forecast','Location','NorthEast');
title('GJR(1,1) Conditional Variances');
datetick;
axis tight;

Plot conditional variance forecasts for 1000 days.

vF1000GARCH = forecast(EstMdlGARCH,1000,'Y0',r);
vF1000EGARCH = forecast(EstMdlEGARCH,1000,'Y0',r);
vF1000GJR = forecast(EstMdlGJR,1000,'Y0',r);

figure;
plot(datesFH(2:end),vF1000GARCH,'b',...
    datesFH(2:end),vF1000EGARCH,'r',...
    datesFH(2:end),vF1000GJR,'k');
legend('GARCH','EGARCH','GJR','Location','NorthEast');
title('Conditional Variance Forecast Asymptote')
datetick;

The forecasts converge asymptotically to the unconditional variances of their repective processes.

Related Examples

Input Arguments

collapse all

Conditional variance model without any unknown parameters, specified as a garch, egarch, or gjr model object.

Mdl cannot contain any properties that have NaN value.

Forecast horizon, specified as a positive integer.

The periods in the forecast horizon must be consistent with the periodicity of Mdl and the presample data.

Data Types: double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Y0',[1 1;0.5 0.5],'V0',[1 0.5;1 0.5] specifies two equivalent presample paths of response data and two, different presample paths of conditional variances.

collapse all

Presample responses whose conditional variance is forecasted, specified as the comma-separated pair consisting of 'Y0' and a numeric column vector or matrix.

Y0 usually represents a time series of presample innovations with mean 0 and variance encompassed in the input conditional variance model Mdl. Y0 can also represent a time series of innovations with mean 0 plus an offset. If Mdl has a nonzero offset, then the software stores its value in the Offset property (Mdl.Offset).

If you specify Y0, then the software derives any necessary presample innovation observations (E0) from Y0 by subtracting any offset. The software uses these presample innovations as initial values for the conditional variance model forecast.

Y0 must have at least Mdl.Q elements or rows to initialize the variance equation. If the number of rows exceeds Mdl.Q, then the software uses the latest Mdl.Q observations to derive presample innovations (denoted E0 in other methods).

  • If Y0 is a column vector, it represents a single path of the underlying innovation series. If V0 is a matrix, then forecast applies Y0 to each path.

  • If Y0 is a matrix, then each column represents a presample path of the underlying innovation series. If V0 is also a matrix, then Y0 must have the same number of columns as V0.

The last element or row contains the latest observation.

For GARCH(P,Q) and GJR(P,Q) models, forecast sets any necessary presample innovations to the unconditional standard deviation of the conditional variance model by default.

For EGARCH(P,Q) models, filter sets any necessary presample innovations to zero by default.

Data Types: double

Presample conditional variances, specified as the comma-separated pair consisting of 'V0' and a numeric column vector or matrix with positive entries. V0 provides initial values for the conditional variance model.

  • If V0 is a column vector, it represents a single presample path of the conditional variance series. If Y0 is a matrix, then forecast applies V0 to each path.

  • If V0 is a matrix, then each column represents a presample path of the underlying conditional variance series. If Y0 is also a matrix, then V0 must have the same number of columns as Y0.

  • For GARCH(P,Q) and GJR(P,Q) models, V0 must have at least Mdl.P rows to initialize the variance equation.

  • For EGARCH(P,Q) models, V0 must have at least max(P,Q) rows to initialize the variance equation.

If the number of elements or rows exceeds the necessary number, then forecast uses the latest observations only.

The last row contains the latest observation.

If Y0 has at least max(P,Q) + P elements or rows, then forecast infers necessary presample observations from the corresponding presample response data in Y0. If you do not specify Y0 or it has insufficient length, the defaults are:

  • For GARCH(P,Q) and GJR(P,Q) models, forecast sets any necessary presample conditional variances to the unconditional variance of the conditional variance process.

  • For EGARCH(P,Q) models, forecast sets any necessary presample conditional variances to the exponentiated, unconditional mean of the logarithm of the EGARCH(P,Q) variance process.

Data Types: double

    Notes  

    • NaNs indicate missing values. forecast removes missing values. The software merges the presample data (Y0 and V0), and then uses list-wise deletion to remove rows containing at least one NaN. Removing missing values in the data reduces the sample size. Removing missing values can also create irregular time series.

    • forecast assumes that you synchronize presample data such that the last observation of each presample series occurs simultaneously.

Output Arguments

collapse all

Minimum mean square error forecasts of conditional variances of future model innovations, returned as a numeric column vector or matrix. V has numPeriods rows and the same number of columns as Y0 and V0. If you do not specify Y0 and V0, then V is a column vector.

The first row (or element) of V contains the conditional variance forecasts in period 1, the second row contains the conditional variance forecasts in period 2, and so on, until the last row. The last row contains the conditional variance forecasts at the forecast horizon specified by the input argument numPeriods.

References

[1] Bollerslev, T. "Generalized Autoregressive Conditional Heteroskedasticity." Journal of Econometrics. Vol. 31, 1986, pp. 307–327.

[2] Bollerslev, T. "A Conditionally Heteroskedastic Time Series Model for Speculative Prices and Rates of Return." The Review of Economics and Statistics. Vol. 69, 1987, pp. 542–547.

[3] Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. Time Series Analysis: Forecasting and Control. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.

[4] Enders, W. Applied Econometric Time Series. Hoboken, NJ: John Wiley & Sons, 1995.

[5] Engle, R. F. "Autoregressive Conditional Heteroskedasticity with Estimates of the Variance of United Kingdom Inflation." Econometrica. Vol. 50, 1982, pp. 987–1007.

[6] Glosten, L. R., R. Jagannathan, and D. E. Runkle. "On the Relation between the Expected Value and the Volatility of the Nominal Excess Return on Stocks." The Journal of Finance. Vol. 48, No. 5, 1993, pp. 1779–1801.

[7] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.

[8] Nelson, D. B. "Conditional Heteroskedasticity in Asset Returns: A New Approach." Econometrica. Vol. 59, 1991, pp. 347–370.

See Also

| | | | | | |

Introduced in R2012a

Was this topic helpful?