The following simulate 10,000 gamma distribution with $$\alpha=2$$ and $$\beta=1$$.

set.seed(10000)
x<-rgamma(10000, shape=2, scale=1)
hist(x, freq=F, main='Histogram of 10,000 Gamma(2, 1) observations')

We will then generate 1,000 data sets with different sample sizes (2, 4, 10, 20, 25, 30, 35, 50, 100, 200, 500) to investigate the distribution of $$\overline{X}$$.

## $breaks ## [1] 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 ## ##$counts
##  [1]  28 121 215 210 172 103  68  45  23   7   6   2
##
## $density ## [1] 0.056 0.242 0.430 0.420 0.344 0.206 0.136 0.090 0.046 0.014 0.012 ## [12] 0.004 ## ##$mids
##  [1] 0.25 0.75 1.25 1.75 2.25 2.75 3.25 3.75 4.25 4.75 5.25 5.75
##
## $xname ## [1] "apply(datamat, 2, \"mean\")" ## ##$equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
## NULL

## $breaks ## [1] 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 ## ##$counts
##  [1]   6  88 214 2