Compare simulated mean and variance with the theoretical values

We will run 1000 rounds of simulation of 40 exponentials with \( \lambda = 0.2 \),
using a fixed seed, and comparing the center of the distribution of the mean
and variance values with the theoretical \( 1 / \lambda \).

Mean

Variance

Simulated

4.99

24.78

Theoretical

5.00

25.00

The simulated and theoretical values are very close, as expected by the CLT.

Assess if the simulated values are approximately normal

Also, according to the CLT, the distribution of the simulated means
should be approximately normal. To illustrate this we will
normalize the vectors and compare it to a \( N(0,1) \) distribution.

Evaluate the coverage of the confidence interval

Theoretically, a 95% confidence interval should contain, if we simulate
a big number of them, the mean value for the exponential distribution
\( 1 / \lambda \) ) 95% of the time.

## [1] 0.9484

As expected, the confidence interval contains the theoretical value 94.84% of the
time (close to the expected 95%).