Overview
The purpose of this data analysis is to investigate the exponential distribution and compare it to the Central Limit Theorem. For this analysis, the lambda will be set to 0.2 for all of the simulations. This investigation will compare the distribution of averages of 40 exponentials over 1000 simulations.
Simulations
Set the simulation variables lambda, exponentials, and seed.
Run Simulations with variables
Sample Mean versus Theoretical Mean
Sample Mean
Calculating the mean from the simulations with give the sample mean.
## [1] 5.055995
Theoretical Mean
The theoretical mean of an exponential distribution is lambda^-1.
## [1] 5
Comparison
There is only a slight difference between the simulations sample mean and the exponential distribution theoretical mean.
## [1] 0.05599526
Sample Variance versus Theoretical Variance
Sample Variance
Calculating the variance from the simulation means with give the sample variance.
## [1] 0.6543703
Theoretical Variance
The theoretical variance of an exponential distribution is (lambda * sqrt(n))^-2.
## [1] 0.625
Comparison
There is only a slight difference between the simulations sample variance and the exponential distribution theoretical variance.
## [1] 0.0293703
Distribution
This is a density histogram of the 1000 simulations. There is an overlay with a normal distribution that has a mean of lambda^-1 and standard deviation of (lambda*sqrt(n))^-1, the theoretical normal distribution for the simulations.
## Warning: package 'ggplot2' was built under R version 3.6.3
ggplot(data.frame(y=simMeans), aes(x=y)) +
geom_histogram(aes(y=..density..), binwidth=0.2, fill="steelblue",color="black") +
stat_function(fun=dnorm, args = list(mean=lambda^-1, sd=(lambda*sqrt(exponentials))^-1), size=2, col = "palegreen") +
labs(title="Plot of the Simulations", x="Simulation Mean")