Plot Examples of the Central Limit Theorem
clt.examp.RdTakes samples of size n from 4 different distributions and
plots histograms of the means along with a normal curve with matching
mean and standard deviation. Creating the plots for different values
of n demonstrates the Central Limit Theorem.
Arguments
- n
size of the individual samples
- reps
number of samples to take from each distribution
- nclass
number of bars in the histograms
- norm.param
List with parameters passed to
rnorm- gamma.param
List with parameters passed to
rgamma- unif.param
List with parameters passed to
runif- beta.param
List with parameters passed to
rbeta
Details
The 4 distributions sampled from are a Normal with defaults mean 0 and standard deviation 1, a gamma with defaults shape 1 (exponential) and lambda 1/3 (mean = 3), a uniform distribution from 0 to 1 (default), and a beta distribution with default alpha 0.35 and beta 0.25 (U shaped left skewed).
The norm.param, gamma.param, unif.param, and
beta.param arguments can be used to change the parameters of
the generating distributions.
Running the function with n=1 will show the populations. Run
the function again with n at higher values to show that the
sampling distribution of the uniform quickly becomes normal and the
exponential and beta distributions eventually become normal (but much
slower than the uniform).
Author
Greg Snow 538280@gmail.com



