This project consists of a simulation exercise. This exercise aims to explore the exponential distribution in R and compare it to the central limit theorem
This part of the project requires the simulation of 40 exponential distributions. These can be simulated with the “rexp()” function. The instructions require the rate parameter lambda to be 0.2. The mean of an exponential distribution is 1/lambda and the standard deviation is also 1/lambda. Thus the variance will be (1/lambda)^2
The above figure maps the frequencies of 1000 random exponentials with rate= 0.2. The distribution is not gaussian.
40 exponentials are simulated and their mean and variance is observed and compared to the theoretical values
The above histogram is Gaussian in nature inspite of the fact that the original distribution is exponential i.e. not Gaussian. This phenomenon is explained by the Central Limit Theorem which states that " the sampling distribution of the mean of any independent, random variable will be normal or nearly normal, if the sample size is large enough."
Below is a comparison of the observed and theoretical values of the mean and variance
## Name Theory Sample
## 1 mean 5 4.9940289
## 2 variance 25 0.6153116
The table shows that while the means are quite similar, the variances are not equivalent. This is because the variance depends on the sample and may change as the sample changes