Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Monte Carlo simulation of vector autoregression (VAR) model

`Y = simulate(Mdl,numobs)`

`Y = simulate(Mdl,numobs,Name,Value)`

```
[Y,E] =
simulate(___)
```

uses additional
options specified by one or more name-value pair arguments. For example, you can specify simulation of multiple paths, exogenous
predictor data, or inclusion of future responses for conditional simulation.`Y`

= simulate(`Mdl`

,`numobs`

,`Name,Value`

)

`simulate`

performs conditional simulation using this process for all pages= 1,...,`k`

`numpaths`

and for each time= 1,...,`t`

`numobs`

.`simulate`

infers (or inverse filters) the innovations`E(`

from the known future responses,:,`t`

)`k`

`YF(`

. For,:,`t`

)`k`

`E(`

,,:,`t`

)`k`

`simulate`

mimics the pattern of`NaN`

values that appears in`YF(`

.,:,`t`

)`k`

For the missing elements of

`E(`

,,:,`t`

)`k`

`simulate`

performs these steps.Draw

`Z1`

, the random, standard Gaussian distribution disturbances conditional on the known elements of`E(`

.,:,`t`

)`k`

Scale

`Z1`

by the lower triangular Cholesky factor of the conditional covariance matrix. That is,`Z2`

=`L*Z1`

, where`L`

=`chol(C,'lower')`

and`C`

is the covariance of the conditional Gaussian distribution.Impute

`Z2`

in place of the corresponding missing values in`E(`

.,:,`t`

)`k`

For the missing values in

`YF(`

,,:,`t`

)`k`

`simulate`

filters the corresponding random innovations through the model`Mdl`

.

`simulate`

uses this process to determine the time origin*t*_{0}of models that include linear time trends.If you do not specify

`Y0`

, then*t*_{0}= 0.Otherwise,

`simulate`

sets*t*_{0}to`size(Y0,1)`

–`Mdl.P`

. 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`simulate`

explicitly uses the first`Mdl.P`

presample responses in`Y0`

to initialize the model, the total number of observations in`Y0`

(excluding any missing values) determines*t*_{0}.

[1]
Hamilton, J. 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.