# forecast

Forecast vector autoregression (VAR) model responses

## Syntax

## Description

returns a path of minimum mean squared error (MMSE) forecasts (`Y`

= forecast(`Mdl`

,`numperiods`

,`Y0`

)`Y`

)
over the length `numperiods`

forecast horizon using the fully
specified VAR(*p*) model `Mdl`

. The forecasted
responses represent the continuation of the presample data
`Y0`

.

uses additional
options specified by one or more name-value arguments. For example, you can specify future exogenous predictor data or
include future responses for conditional forecasting. `Y`

= forecast(`Mdl`

,`numperiods`

,`Y0`

,`Name,Value`

)

## Examples

## Input Arguments

## Output Arguments

## Algorithms

`forecast`

estimates unconditional forecasts using the equation$${\widehat{y}}_{t}={\widehat{\Phi}}_{1}{\widehat{y}}_{t-1}+\mathrm{...}+{\widehat{\Phi}}_{p}{\widehat{y}}_{t-p}+\widehat{c}+\widehat{\delta}t+\widehat{\beta}{x}_{t},$$

where

*t*= 1,...,`numperiods`

.`forecast`

filters a`numperiods`

-by-`numseries`

matrix of zero-valued innovations through`Mdl`

.`forecast`

uses specified presample innovations (`Y0`

) wherever necessary.`forecast`

estimates conditional forecasts using the Kalman filter.`forecast`

represents the VAR model`Mdl`

as a state-space model (`ssm`

model object) without observation error.`forecast`

filters the forecast data`YF`

through the state-space model. At period*t*in the forecast horizon, any unknown response is$${\widehat{y}}_{t}={\widehat{\Phi}}_{1}{\widehat{y}}_{t-1}+\mathrm{...}+{\widehat{\Phi}}_{p}{\widehat{y}}_{t-p}+\widehat{c}+\widehat{\delta}t+\widehat{\beta}{x}_{t},$$

where $${\widehat{y}}_{s},$$

*s*<*t*, is the filtered estimate of*y*from period*s*in the forecast horizon.`forecast`

uses specified presample values in`Y0`

for periods before the forecast horizon.

The way

`forecast`

determines`numpaths`

, the number of pages in the output argument`Y`

, depends on the forecast type.If you estimate unconditional forecasts, which means you do not specify the name-value pair argument

`YF`

, then`numpaths`

is the number of pages in the input argument`Y0`

.If you estimate conditional forecasts and

`Y0`

and`YF`

have more than one page, then`numpaths`

is the number of pages in the array with fewer pages. If the number of pages in`Y0`

or`YF`

exceeds`numpaths`

, then`forecast`

uses only the first`numpaths`

pages.If you estimate conditional forecasts and either

`Y0`

or`YF`

has one page, then`numpaths`

is the number of pages in the array with the most pages.`forecast`

uses the array with one page for each path.

`forecast`

sets the time origin of models that include linear time trends (*t*_{0}) to`size(Y0,1)`

–`Mdl.P`

(after removing missing values). Therefore, the times in the trend component are*t*=*t*_{0}+ 1,*t*_{0}+ 2,...,*t*_{0}+`numobs`

. This convention is consistent with the default behavior of model estimation in which`estimate`

removes the first`Mdl.P`

responses, reducing the effective sample size. Although`forecast`

explicitly uses the first`Mdl.P`

presample responses in`Y0`

to initialize the model, the total number of observations (excluding missing values) determines*t*_{0}.

## References

[1]
Hamilton, James D. *Time Series Analysis*. Princeton, NJ: Princeton University Press, 1994.

[2]
Johansen, S. *Likelihood-Based Inference in Cointegrated Vector Autoregressive Models*. Oxford: Oxford University Press, 1995.

[3]
Juselius, K. *The Cointegrated VAR Model*. Oxford: Oxford University Press, 2006.

[4]
Lütkepohl, H. *New Introduction to Multiple Time Series Analysis*. Berlin: Springer, 2005.

## Version History

**Introduced in R2017a**