This is part one to the two part projects (1. A simulation excercise, 2. Basic inferential data analysis). Here, I will investigate the exponential distribution in R and compare it to the Central Limit Theorem. The mean and standard deviation of the exponential distribution is 1/lambda. Lambda will be set to 0.2 for all simulations, and there will be 1000 simulations. I will also determine the distribution of averages for 40 exponentials.
Set the seed, the rate parameter, the number of exponentials, and the number of simulations based on the rubric:
simulate the 40 exponentials, then calculate the mean.
Calculate and compare the sample mean to the theoretical mean.
## [1] 4.974239
## [1] 5
Develop a histogram of the simulated exponential sample means. The
red indicates the sample mean while the blue indicates the theoretical
mean.
Based on the graph, the sample mean is very close to the theoretical
mean.
Calculate and compare the sample variance to the theoretical variace.
## [1] 0.5706551
## [1] 0.625
The sample variance is equal to 0.571 which is very close to the theoretical variance of 0.625.
Investigate whether the exponential distribution is approximately
normal. Based on CLT, the mean should be relatively normal.
Based on the figure, the distribution of means follows a normal curve
relatively closely. If there were to be more trials (>1000) the curve
would likely be closer to a normal distribution.