Week 1 Discussion

Using R, generate 100 simulations of 30 samples each from a distribution (other than normal) of your choice. Graph the sampling distribution of means. Graph the sampling distribution of the minimum. Share your graphs and your R code. What did the simulation of the means demonstrate? What about the distribution of the minimum…?

Using a Poisson distribution with \(\lambda\) = 4:

s <- sapply(1:100, function(x) sample(rpois(100, lambda = 4), 30))

Plots

Sampling distribution of the means:

qplot(colMeans(s), main='Distribution of Sampled Means', xlab='Sampled Mean',   
       geom= "histogram" )
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Sampling distribution of the min:

qplot(apply(s,2,min), main='Distribution of Sampled Mins', xlab='Sampled Min', 
      geom= "histogram", binwidth = 0.5)

The graph of the sampling distribution of the mean approaches normality (Central Limit Theorem), particularly if we increase the number of simulations.

Also of note is that distribution of the means in this distribution centers around the value of \(\lambda\) used in the Poisson distribution. The expected value of a Poission random variable is \(\lambda\).

The graph of the sampling distribution of the minimum is not normal and skewed.

Using \(\lambda\) = 6:

s <- sapply(1:100, function(x) sample(rpois(100, lambda = 6), 30))

qplot(colMeans(s), main='Distribution of Sampled Means', xlab='Sampled Mean', bins=30,
       geom= "histogram" )