## Monte Carlo Simulation of Regression Models with ARIMA Errors

### What Is Monte Carlo Simulation?

Monte Carlo simulation is the process of generating independent,
random draws from a specified probabilistic model. When simulating
time series models, one draw (or realization) is an entire sample
path of specified length *N*, *y*_{1}, *y*_{2},...,*y _{N}*.
When you generate a large number of draws, say

*M*, you generate

*M*sample paths, each of length

*N*.

**Note**

Some extensions of Monte Carlo simulation rely on generating
dependent random draws, such as Markov Chain Monte Carlo (MCMC). The `simulate`

function
in Econometrics Toolbox™ generates independent realizations.

Some applications of Monte Carlo simulation are:

Demonstrating theoretical results

Forecasting future events

Estimating the probability of future events

### Generate Monte Carlo Sample Paths

The time series portion of the model specifies the dynamic evolution of the unconditional disturbance process over time through a conditional mean structure. To perform Monte Carlo simulation of regression models with ARIMA errors:

Specify presample innovations or unconditional disturbances (or use default presample data).

Generate an uncorrelated innovation series from a probability distribution.

Filter the innovations through the ARIMA error model to obtain the simulated unconditional disturbances.

Use the regression model, predictor data, and simulated unconditional disturbances to obtain the responses.

For example, consider simulating *N* responses from the
regression model with ARMA(2,1) errors:

$$\begin{array}{l}{y}_{t}={X}_{t}\beta +{u}_{t}\\ {u}_{t}={\varphi}_{1}{u}_{t-1}+{\varphi}_{2}{u}_{t-2}+{\epsilon}_{t}+{\theta}_{1}{\epsilon}_{t-1},\end{array}$$

where *ε _{t}* is Gaussian
with mean 0 and variance

*σ*

^{2}. Given presample unconditional disturbances (

*u*

_{0}and

*u*

_{–1}) and innovations (

*ε*

_{0}), following these steps:

Generate

*N*independent innovations from the Gaussian distribution:$$\{{\widehat{\epsilon}}_{1},{\widehat{\epsilon}}_{2},\mathrm{...},{\widehat{\epsilon}}_{N}\}.$$

Filter the innovations recursively to obtain the unconditional disturbances:

$${\widehat{u}}_{1}={\varphi}_{1}{u}_{0}+{\varphi}_{2}{u}_{-1}+{\widehat{\epsilon}}_{1}+{\epsilon}_{0}$$

$${\widehat{u}}_{2}={\varphi}_{1}{\widehat{u}}_{1}+{\varphi}_{2}{u}_{0}+{\widehat{\epsilon}}_{2}+{\widehat{\epsilon}}_{1}$$

$${\widehat{u}}_{3}={\varphi}_{1}{\widehat{u}}_{2}+{\varphi}_{2}{\widehat{u}}_{1}+{\widehat{\epsilon}}_{3}+{\widehat{\epsilon}}_{2}$$

...

$${\widehat{u}}_{N}={\varphi}_{1}{\widehat{u}}_{N-1}+{\varphi}_{2}{\widehat{u}}_{N-2}+{\widehat{\epsilon}}_{N}+{\widehat{\epsilon}}_{N-1}.$$

Obtain simulated responses using the unconditional disturbances, regression model, and the predictors:

$${\widehat{y}}_{t}={X}_{t}\beta +{\widehat{u}}_{t}.$$

Econometrics Toolbox automates this process with `simulate`

. Pass in a fully specified regression model with ARIMA errors
(`regARIMA`

), the number of responses to
simulate, and, optionally, the number of paths and presample data, and
`simulate`

simulates the responses.

**Note**

Econometrics Toolbox treats the predictors in the regression model as fixed, nonstochastic series. Therefore, in order to generate Monte Carlo sample paths of the response, you need to know the values of the predictors.

### Monte Carlo Error

Using many simulated paths, you can estimate various features
of the model. However, Monte Carlo estimation is based on a finite
number of simulations. Therefore, Monte Carlo estimates are subject
to some amount of error. You can reduce the amount of Monte Carlo
error in your simulation study by increasing the number of sample
paths, *M*, that you generate from your model.

For example, to estimate the probability of a future event:

Generate

*M*sample paths from your model.Estimate the probability of the future event using the sample proportion of the event occurrence across

*M*simulations,$$\widehat{p}=\frac{\#\text{\hspace{0.17em}}\text{\hspace{0.17em}}times\text{\hspace{0.17em}}\text{\hspace{0.17em}}event\text{\hspace{0.17em}}\text{\hspace{0.17em}}occurs\text{\hspace{0.17em}}\text{\hspace{0.17em}}in\text{\hspace{0.17em}}\text{\hspace{0.17em}}M\text{\hspace{0.17em}}\text{\hspace{0.17em}}draws}{M}.$$

Calculate the Monte Carlo standard error for the estimate,

$$se=\sqrt{\frac{\widehat{p}(1-\widehat{p})}{M}}.$$

You can reduce the Monte Carlo error of the probability estimate by increasing the number of realizations. If you know the desired precision of your estimate, you can solve for the number of realizations needed to achieve that level of precision.

## See Also

## Related Examples

- Simulate Regression Models with ARMA Errors
- Simulate Regression Models with Nonstationary Errors
- Simulate Regression Models with Multiplicative Seasonal Errors