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.clt.examp(n = 1, reps = 10000, nclass = 16, norm.param=list(mean=0,sd=1),
gamma.param=list(shape=1, rate=1/3), unif.param=list(min=0,max=1),
beta.param=list(shape1=0.35, shape2=0.25))rnormrgammarunifrbetanorm.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).rnorm, rexp, runif,
rbetaclt.examp()
clt.examp(5)
clt.examp(30)
clt.examp(50)Run the code above in your browser using DataLab