Main Content

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

**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

Conditional mean models specify the dynamic evolution of a process over time through the conditional mean structure. To perform Monte Carlo simulation of conditional mean models:

Specify presample data (or use default presample data).

Generate an uncorrelated innovation series from the innovation distribution that you specified.

Generate responses by recursively applying the specified AR and MA polynomial operators. The AR polynomial operator can include differencing.

For example, consider an AR(2) process,

$${y}_{t}=c+{\varphi}_{1}{y}_{t-1}+{\varphi}_{2}{y}_{t-2}+{\epsilon}_{t}.$$

Given presample responses *y*_{0} and *y*_{–1}, and simulated innovations $${\epsilon}_{1},\dots ,{\epsilon}_{N},$$ realizations of the process are recursively generated:

$${y}_{1}=c+{\varphi}_{1}{y}_{0}+{\varphi}_{2}{y}_{-1}+{\epsilon}_{1}$$

$${y}_{2}=c+{\varphi}_{1}{y}_{1}+{\varphi}_{2}{y}_{0}+{\epsilon}_{2}$$

$${y}_{3}=c+{\varphi}_{1}{y}_{2}+{\varphi}_{2}{y}_{1}+{\epsilon}_{3}$$

$$\vdots $$

$${y}_{N}=c+{\varphi}_{1}{y}_{N-1}+{\varphi}_{2}{y}_{N-2}+{\epsilon}_{N}$$

For an MA(12) process, e.g.,

$${y}_{t}=c+{\epsilon}_{t}+{\theta}_{1}{\epsilon}_{t-1}+{\theta}_{12}{\epsilon}_{t-12},$$

you need 12 presample innovations to initialize the simulation. By default, `simulate`

sets presample innovations equal to zero. The remaining *N* innovations are randomly sampled from the innovation process.

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.

- Simulate Stationary Processes
- Simulate Trend-Stationary and Difference-Stationary Processes
- Simulate Multiplicative ARIMA Models
- Simulate Conditional Mean and Variance Models
- Forecast IGD Rate from ARX Model