forecast
Forecast vector autoregression (VAR) model responses
Syntax
Description
Conditional and Unconditional Forecasts for Numeric Arrays
returns a numeric array containing paths of minimum mean squared error (MMSE)
multivariate response forecasts Y
= forecast(Mdl
,numperiods
,Y0
)Y
over a length
numperiods
forecast horizon, using the fully specified
VAR(p) model Mdl
. The forecasted
responses represent the continuation of the presample data in the numeric array
Y0
.
uses additional options specified by one or more name-value arguments.
Y
= forecast(Mdl
,numperiods
,Y0
,Name=Value
)forecast
returns numeric arrays when all optional
input data are numeric arrays. For example,
forecast(Mdl,10,Y0,X=Exo)
returns a numeric array
containing a 10-period forecasted response path from Mdl
and the numeric matrix of presample response data Y0
, and
specifies the numeric matrix of future predictor data for the model regression
component in the forecast horizon Exo
.
To produce a conditional forecast, specify future response data in a numeric
array by using the YF
name-value argument.
Unconditional Forecasts for Tables and Timetables
returns the table or timetable Tbl2
= forecast(Mdl
,numperiods
,Tbl1
)Tbl2
containing the length
numperiods
paths of multivariate MMSE response variable
forecasts, which result from computing unconditional forecasts from the VAR
model Mdl
. forecast
uses the table
or timetable of presample data Tbl1
to initialize the
response series. (since R2022b)
forecast
selects the variables in
Mdl.SeriesNames
to forecast, or it selects all variables
in Tbl1
. To select different response variables in
Tbl1
to forecast, use the
PresampleResponseVariables
name-value argument.
uses additional options specified by one or more name-value arguments. For
example, Tbl2
= forecast(Mdl
,numperiods
,Tbl1
,Name=Value
)forecast(Mdl,10,Tbl1,PresampleResponseVariables=["GDP"
"CPI"])
returns a timetable of response variables containing their
unconditional forecasts from the VAR model Mdl
, initialized
by the data in the GDP
and CPI
variables
of the timetable of presample data in Tbl1
. (since R2022b)
Conditional Forecasts for Tables and Timetables
returns the table or timetable Tbl2
= forecast(Mdl
,numperiods
,Tbl1
,InSample=InSample
,ResponseVariables=ResponseVariables
)Tbl2
containing the length
numperiods
paths of multivariate MMSE response variable
forecasts and corresponding forecast MSEs, which result from computing
conditional forecasts from the VAR model Mdl
.
forecast
uses the table or timetable of presample
data Tbl1
to initialize the response series.
InSample
is a table or timetable of future data in the
forecast horizon that forecast
uses to compute
conditional forecasts and ResponseVariables
specifies the
response variables in InSample
. (since R2022b)
uses additional options specified by one or more name-value arguments. (since R2022b)Tbl2
= forecast(Mdl
,numperiods
,Tbl1
,InSample=InSample
,ResponseVariables=ResponseVariables
,Name=Value
)
Examples
Input Arguments
Output Arguments
Algorithms
forecast
estimates unconditional forecasts using the equationwhere t = 1,...,
numperiods
.forecast
filters anumperiods
-by-numseries
matrix of zero-valued innovations throughMdl
.forecast
uses specified presample innovations (Y0
orTbl1
) wherever necessary.forecast
estimates conditional forecasts using the Kalman filter.forecast
represents the VAR modelMdl
as a state-space model (ssm
model object) without observation error.forecast
filters the forecast dataYF
through the state-space model. At period t in the forecast horizon, any unknown response iswhere s < t, is the filtered estimate of y from period s in the forecast horizon.
forecast
uses specified presample values inY0
orTbl1
for periods before the forecast horizon.
The way
forecast
determinesnumpaths
, the number of paths (pages) in the output argumentY
, or the number of paths (columns) in the forecasted response variables in the output argumentTbl2
, depends on the forecast type.If you estimate unconditional forecasts, which means you do not specify the
YF
name-value argument, orInSample
andResponseVariables
name-value arguments,numpaths
is the number of paths in theY0
orTbl1
input argument.If you estimate conditional forecasts and the presample data
Y0
and future sample dataYF
, or response variables inTbl1
andInSample
have more than one path,numpaths
is the fewest number of paths between the presample and future sample response data. Consequently,forecast
uses only the firstnumpaths
paths of each response variable for each input.If you estimate conditional forecasts and either
Y0
orYF
, or response variables inTbl1
orInSample
have one path,numpaths
is the number of pages in the array with the most pages.forecast
uses the variables with one path to produce each output path.
forecast
sets the time origin of models that include linear time trends t0 tonumpreobs
–Mdl.P
(after removing missing values), wherenumpreobs
is the number of presample observations. Therefore, the times in the trend component are t = t0 + 1, t0 + 2,..., t0 +numpreobs
. This convention is consistent with the default behavior of model estimation in whichestimate
removes the firstMdl.P
responses, reducing the effective sample size. Althoughforecast
explicitly uses the firstMdl.P
presample responses inY0
orTbl1
to initialize the model, the total number of usable observations determines t0. An observation inY0
is usable if it does not contain aNaN
.
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.