This is a comparison of a distribution of the averages of exponential samples. The mean and variance will be compared to theoretical values and the distribution will be compared to a normal distribution.
Before comparisons to mean, variance and overall distribution can be made, simulations must be ran. Lambda will be set to 0.2, the average of 40 exponentials will be taken and this simulation will run for 1000 iterations.
MExp = NULL
set.seed(33)
for (i in 1:1000) MExp = c(MExp, mean(rexp(40,0.2)))
MVar = NULL
set.seed(33)
for (i in 1:1000) MVar = c(MVar, (MExp[i]-mean(MExp))*sqrt(40)/(1/.2))
The sample is very close to the theoretical value.
AExp = NULL
set.seed(33)
for (i in 1:1000)
AExp = c(AExp, mean(rexp(40,.2)))
The collection of averages much more closely resembles a normal distribution than a random collection of 1000 exponential samples.