Exponential Distribution using R for 100 simulations of 30 samples

simdata = rexp(n=3000,rate=.2)
matrixdata = matrix(simdata,nrow=100,ncol=30)
means.exp = apply(matrixdata,1,mean)
mean(means.exp)
## [1] 4.87929
sd(means.exp)
## [1] 0.8339184
var((means.exp))
## [1] 0.69542
hist(means.exp)

Estimated mean of 30 samples running for 100 simulations is 5.00778, and it is quiet evident from the graph that the distribution of random numbers are normally distributed with few outliers which tends to make the distribution looks right skewed.

True mean will be 1/lambda = 1/0.2 = 5 which is near to the estimated mean with standard deviation=0.861 and variance= 0.742, so we will calculate the upper and lower confidence interval should contain 95% of the data as provided below:

se = sd(means.exp)/sqrt(30)
lower = mean(means.exp) - 1.96 * se
upper = mean(means.exp) + 1.96 * se
c(lower, upper)
## [1] 4.580876 5.177703