clt.examp {TeachingDemos}R Documentation

Plot Examples of the Central Limit Theorem

Description

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.

Usage

clt.examp(n = 1, reps = 10000, nclass = 16)

Arguments

n size of the individual samples
reps number of samples to take from each distribution
nclass number of bars in the histograms

Details

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).

Value

This function is run for its side effect of creating plots. It returns NULL invisibly.

Author(s)

Greg Snow greg.snow@intermountainmail.org

See Also

rnorm, rexp, runif, rbeta

Examples

clt.examp()
clt.examp(5)
clt.examp(30)
clt.examp(50)


[Package TeachingDemos version 1.4 Index]