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…?

#Geometric Distribution: Iterations until first success
geomDist <- function (iter, samplesize, p) {
   means <- c() #empty vector
   mins <- c() #empty vector
   for (i in 1:iter) {
     samp <- rgeom(samplesize, p)
     #store the means/mins in the empty vectors
     means <- c(means, mean(samp))
     mins <- c(mins, min(samp))
  }
   
   df <- data.frame(means=means, mins=mins)
   return(df)

 }
 
#Probability of 0.01 
data <- geomDist(100, 30, 0.01)


hist(data$means, breaks = 15)

hist(data$mins, breaks = 15)

median(data$means)
## [1] 97.23333
median(data$mins)
## [1] 2

The simulation of the means shows to be fairly normal and centered at around 100, which is what you would expect given the probability of success of 0.01. The minimum of those samples is right skewed with the median minimum value in the distribution of around 2.