Overview:
In this exercise we shall examine the sampling distribution of sample mean and variance the Exponential distribution, its means and variance. We shall than compare it to the properties of the Central Limit Theroem. In particular, we examine the properties of the mean distributions, i.e the Sample mean vis a vis the Population mean.
Simulations:
We simulate 1000 Exponential distributions with size n=40 and Lambda = .2. The following R Code illustrates our simulation. In the following R code we compute a matrix of Random Exponential Number computed by the rexp function. Each matrix row has 40 elements and the overall matrix has 1000 rows. Our goal is to test the sample mean and variance of the sample mean using this matrix sample.
lambda_val <- .2
size_of_each_set <- 40
num_of_sims <- 1000
m1 <- matrix(replicate(1000,rexp(40,.2)),ncol=40)
m1_means <- apply(m1,1,mean)
m1_var <- apply(m1,1,var)
Sample Mean versus Theoretical Mean:
In the Theoretical Mean, he mean of exponential distribution is 1/lambda and the standard deviation is also 1/lambda. The following table illusrates proximity of our simulated means of samples and their variance/distributions to their theoretical counterparts.
% latex table generated in R 3.1.3 by xtable 1.7-4 package % Sat Jul 25 14:40:20 2015Sample Variance versus Theoretical Variance: Include figures (output from R) with titles. Highlight the variances you are comparing. Include text that explains your understanding of the differences of the variances.
#mean(m1_means)
#m1_var <- apply(m1,1,var)mns = NULL
##for (i in 1 : 1000) mns = c(mns, mean(rexp(40,.2)))
#hist(mns)
Distribution:
Via figures and text, explain how one can tell the distribution is approximately normal.
A Histogram of distribution of 1000 random uniforms is displayed below with rexp(n, lambda) where lambda is the rate parameter. We can observe that the actual data is evenly distributed about the population, as one would expect. Now compare that with a sampling of the distribution of 1000 averages of 40 random uniforms. The CLT alludes to this. T
lambda_val = .2
size_of_each_set <- 40
num_of_sims <- 1000
mean = 1/.2
hist(rexp(1000,.2))
mns = NULL
for (i in 1 : 1000) mns = c(mns, mean(rexp(40,.2)))
hist(mns)
lambda_val = .2
size_of_each_set <- 40
num_of_sims <- 1000
hist(rexp(1000,.2))
#summary(cars)
You can also embed plots, for example: