Академический Документы
Профессиональный Документы
Культура Документы
Rodrigo Farruguia
April 1, 2016
Overview:
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.
Simulations
1000 samples of size 40 from and explonential distribution using a lambda of .2 .
We use rexp for this, also 1/lambda is the standard diviation and the exponential
distribution.
#number of seeds for reproduceability
set.seed(304)
# Variables to be used extracted from the overview.
lambda <- 0.2 # the lambda for experiments.
n <- 40 # number of experimentals used
numsims <- 1000 #number of simulations
5.013
5.000
A histogram representing the distribution of our sample means the vertical lines
are the mean of the distribution and the theoretical mean.By the comparison
numbers we got above we can tell from the graph that the lines will almost
overlap eachother.
Frequency
60
40
20
0
4
Sample Mean
0.637
0.625
ibution
The averages of the samples should follow the normal distribution. We do this
by plotting and compairing the distribution of the samples mean and normal
distribution
Frequency
0.4
0.3
0.2
0.1
0.0
4
Sample mean
sample
theoretical
Lets see how it plots on a line to see that the theoretical normal distribution is a
match to the sample mean.You can see the distribution is approximately linear
normal