clt.examp {TeachingDemos} | R Documentation |
Takes 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.
clt.examp(n = 1, reps = 10000, nclass = 16)
n |
size of the individual samples |
reps |
number of samples to take from each distribution |
nclass |
number of bars in the histograms |
The 4 distributions sampled from are a Normal with mean 0 and standard deviation 1, an exponential with lambda 1/3 (mean = 3), a uniform distribution from 0 to 1, and a beta distribution with alpha 0.35 and beta 0.25 (U shaped left skewed).
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).
This function is run for its side effect of creating plots. It returns NULL invisibly.
Greg Snow greg.snow@intermountainmail.org
clt.examp() clt.examp(5) clt.examp(30) clt.examp(50)