Goals

Illustrate via simulation and associated explanatory text the properties of the distribution of the mean of 40 exponentials. Namely: a) Show the sample mean and compare it to the theoretical mean of the distribution. b) Show how variable the sample is (via variance) and compare it to the theoretical variance of the distribution. c) Show that the distribution is approximately normal.

Data Processing

Performing 1000 simulations of the mean of 40 exponentials with rate = .2:

set.seed(1)
setexp = NULL
for (i in 1 : 1000) setexp = c(setexp, mean(rexp(40, rate=.2)))

The sample mean value is

mean(setexp)
## [1] 4.990025

Which is very close to 5, the theoretical mean.

The sample variance is

var(setexp)
## [1] 0.6111165

Which is also very close the theoretical variance, which is 25/40 = .625.

Below we have a graphic approach to show these values:

 hist(setexp, main = "Histogram of mean of 40 exponentials", xlab = "Mean")
 abline(v=5, col = 'blue')
 abline(v=mean(setexp), col = 'red')
 abline(v=5+(5/sqrt(40)), col = 'green')
 abline(v=5+sd(setexp), col = 'green')
 abline(v=5+sd(setexp), col = 'orange')
 legend("topright", legend = c("Expected Mean", "Sample Mean", "Exp Mean + Exp SD", "Exp Mean + Sample SD"), col=c('blue','red','green','orange'), lwd=1, bty="N", text.font = 1)

Finally, the CLM tells us that the standartized mean is approximately Normal with mean 0 and variance 1. Below we have the standartized mean and 40 exponentials and the standard normal graph overlayed:

hist( (setexp-5)*sqrt(40)/5, prob=TRUE, main = "Histogram of standartized mean of 40 exponentials", xlab = "standartized mean")
curve(dnorm(x, mean=0, sd=1),  lwd=2, add=TRUE, yaxt="n")