rpanel (version 1.1-4)

rp.sample: Interactive demonstration of sampling variation

Description

Plots sample from a normal distribution to illustrate the variation which results. The population mean and the range of mean +/- 2 standard deviations can be superimposed, in the latter case to demonstrate that nearly all the data lie within this range. The position of the sample mean can also be indicated in a separate plot where the mean and +/- 2 standard errors can be superimposed.

Usage

rp.sample(mu = 0, sigma = 1, n = 25, panel.plot = TRUE, hscale = NA, vscale = hscale)

Arguments

mu

the mean of the normal distribution.

sigma

the standard deviation of the normal distribution.

n

the size of the sample.

panel.plot

a logical parameter which determines whether the plot is placed inside the panel (TRUE) or the standard graphics window (FALSE). If the plot is to be placed inside the panel then the tkrplot library is required.

hscale, vscale

scaling parameters for the size of the plot when panel is set to TRUE. The default values are 1 on Unix platforms and 1.4 on Windows platforms.

Value

Nothing is returned.

Details

The visual effect of the animation is assisted by holding the axes constant. This means that there may occasionally be observations outside the displayed horizontal range, or a histogram height which exceeds the displayed vertical range. In both these cases, the existence of the unseen data is signalled by red lines in the appropriate positions.

References

rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.

Examples

Run this code
# NOT RUN {
   rp.sample()
# }

Run the code above in your browser using DataCamp Workspace