# monte carlo simulation - confidence intervals construction

I am starting with Monte Carlo Simulation. I have run simulation to estimate the mean and the variance of the exponential distribution.

Simulation:
I have generated random sample from uniform distribution (sample size n) and then using the inverse function method generated the exponential distribution. I have run this simulation N1, N2, and N3 times where N1 < N2 < N3.

Results:
All worked well, when I plot the results I can see that the distribution of means and variances tends to the normal distribution as the number of simulation increases.

Questions:
1) Would you please help and clarify how the empirical and theoretical confidence intervals should be derived?
2) what is the manifestation of the Law of Large Numbers in this exercise?
3) and what is manifestation of Central Limit Theorem in this exercise?

1. I don't know what you mean by a theoretical confidence interval, perhaps a confidence interval where you use the value of $\sigma$ which is known in advance? As for the empirical confidence interval, that would be

$$\left (\overline{X}-\frac{t_{N,\alpha} S}{\sqrt{N}},\overline{X}+\frac{t_{N,\alpha} S}{\sqrt{N}} \right )$$

where $\overline{X}$ is the sample mean, $S$ is the sample standard deviation, $N$ is the sample size, and $t_{N,\alpha}$ comes from Student's $t$ distribution. Specifically, if you want your interval to have confidence $0<\alpha<1$, then $t_{N,\alpha}$ is the number $b$ such that the probability for Student's $t$ distribution with $N-1$ degrees of freedom to be between $-b$ and $b$ is $\alpha$. For large $N$ this is well-approximated by the corresponding value from the standard normal distribution.

1. You should see that your sample means are all close to the true mean if $N$ is large. (In this form I am using the strong law of large numbers; you need a whole bunch of sample means to make sense of the weak law of large numbers).

2. If you take a bunch of sample means for a large but fixed $N$, $\mu$ is the true mean and $\sigma$ is the true standard deviation, then you have a bunch of instances of $\overline{X}$. If you make a histogram of the quantity $\sqrt{N}\frac{\overline{X}-\mu}{\sigma}$ using these values of $\overline{X}$, the distribution you get should look approximately like a standard normal.

• the theoretical -> the true values, empirical -> estimated. Would you please clarify what N are you using in the equation, is this the sample size used in singles simulation (the same for each series of simulation N1,N2,N3)? (I used n for sample size and N for number of simulation). – Michal Nov 4 '15 at 13:53
• @Michal My $N$ is the sample size, not the number of simulations. And I still don't understand what you mean by a theoretical confidence interval; if you know $\mu$ already then the "interval estimate" for $\mu$ is just $\{ \mu \}$ (with no range of possible errors at all). The only notion of "theoretical confidence interval" that I know of is the one that I alluded to, where you know $\sigma$ but not $\mu$ in advance. – Ian Nov 4 '15 at 13:56
• I still don't really understand what exactly you want with the theoretical confidence interval, even after seeing your suggestion as to what it would be. On the one hand, you could take a normally distributed model: if the mean is $\lambda$ and the standard deviation is also $\lambda$ then you have the "theoretical confidence interval" $\left ( \lambda-z_\alpha \frac{\lambda}{\sqrt{N}},\lambda+z_\alpha\frac{\lambda}{\sqrt{N}} \right )$ where $z_\alpha$ is such that $P(-z_\alpha \leq Z \leq z_\alpha)=\alpha$. – Ian Nov 4 '15 at 14:03
• This normal model, rather than a Student's t distribution model, is appropriate because $\sigma$ is known exactly in advance. But if you already know both parameters then you can actually do the calculus, that is, you can (at least in principle) solve $\int_{\max \{ 0,\lambda-\delta \}}^{\lambda+\delta} \frac{1}{\lambda} e^{-x/\lambda} dx=\alpha$ for $\delta$. – Ian Nov 4 '15 at 14:03
• ok, I got the concept. The empirical and theoretical intervals were stated in the exercise, but I agree that it is a bit confusing. Your explanation makes sense. </br> One more question to number of simulation, the increased number of simulation will impact the values of estimates so that the mean will be closer to the true one and variance will be decreasing, so technically the N1, N2 and N3 will be used only in the equations for the mean and variance for each simulation series, correct? – Michal Nov 4 '15 at 14:25