# Monte Carlo¶

The basic idea behind using the Monte Carlo method is to run simulations over and over to get a probability distribution of an unknown probabilistic entity. Numerical methods such as Monte Carlo are often helpful when analytical methods are too difficult to solve or don’t exist.

• In this section we will use a Monte Carlo method to explore the bias of an AR(1) process. First, suppose an AR(1) process of the form:
$y_t = \mu + \phi y_{t-1} + \epsilon _t$
• Now suppose that $$\mu = 1$$ and $$\phi = 0.95$$ and $$\epsilon_t \sim N(0,4)$$

• In Matlab, we want to simulate data for this process and then estimate $$\phi$$. Then, we want to repeat the simulation and estimation process several times, each time saving our estimate of $$\phi$$.

• Once we have done this enough times, we will have a distribution of the estimated $$\phi$$. Then we can compare the distribution to the true value.

• In this example we will show that our selected parameters result in a biased estimate of $$\phi$$.

• Now, simulate the data and estimate $$\phi$$ using this code:
• The second to last line of code plots the distribution of $$\phi$$‘s relative to a normal distribution. As you can see, the disrtibution is not normal
• The last line of code tells you the percentage of estimated $$\phi$$‘s that are smaller than the actual value. Running this code will show you that there is a lot more probability mass to the left of the actual value, exposing a bias in our estimation