Overview

This report represents exponential distribution in R and compares it with the Central Limit Theorem.It investigates the distribution of averages of 40 exponentials and does 1000 simulations for this. The results from the analyisis confirms that the bigger your number of simulations, the closest your distribution gets to a normal distribution.

Simulations

In the first section of the code below we have added the details for the Exponential distribution and create a vector that saves the averages of 40 exponentials one thousand times.

n <- 40
lambda <- 0.2
nsims=1:1000
set.seed(15)
mns = NULL
for (i in nsims) mns = c(mns, mean(rexp(n,lambda)))

In the next chunck of code we calculate the values of the distribution and the expected/sample values/

#Values for distribution
meanDist<- mean(mns)
SdDist<- sd(mns)
varDist<- var(mns)

#Expected/sample values
meanExp<- 1/lambda
SdExp<- (1/lambda)/sqrt(n)
varExp<- SdExp^2

Sample Mean versus Theoretical Mean:

The Sample Mean is 5 (shown in red in the graph below) and the Theoretical Mean is 4.9805352 (shown in yellow). The difference is 0.0194648.

Sample Variance versus Theoretical Variance:

The Sample Variance is 0.625 and the Theoretical Variance is 0.6186672. The difference is 0.0063328.

Distribution:

The follwoing graph represents the histogram of the 1000 simulations using the Exponential Distribution. In order to undertand if the distribution approximately normal, a bell curve has been added on top.