Professional Documents
Culture Documents
Christian Ibanez
August 28, 2018
In this project you will investigate the exponential distribution in R and compare it with the Central Limit Theorem. The exponential distribution can
be simulated in R with rexp(n, lambda) where lambda is the rate parameter. The mean of exponential distribution is 1/lambda and the standard
deviation is also 1/lambda. Set lambda = 0.2 for all of the simulations. You will investigate the distribution of averages of 40 exponentials. Note that
you will need to do a thousand simulations.
## [1] 40000
## [1] 1000
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
theoretical_mean <- 1/lambda
Simulated mean
As we expected, the difference between the mean is small, but we can further decrease this mean difference if we increase the number of sample
size
mean_difference
## [1] 0.0142497
Theoretical Variance
Simulated Variance
As we expected, the difference between the variance is small, but we can further decrease this variance difference if we increase the number of
sample size
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
variance_difference
## [1] 0.06121985
Theoretical SD vs Simulated SD
Theoretical SD
Simulated SD
As we expected, the difference between the SD is small, but we can further decrease this SD difference if we increase the number of sample size
SD_difference
## [1] 0.03781446
Distribution
library("ggplot2")
dist <- dist + geom_histogram(aes(y = ..density..), colour = "dark blue", fill = "grey")
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
dist <- dist +labs(title = "Distribution of means of n = 40 from a thousand simulations", x = "Mean of n = 40", y
= "Density")
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Confidence Interval
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
simulated_CI
theoretical_CI
If you test a hypothesis with this confidence interval, the null hypothesis will be rejected
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD