rp.sample: Interactive demonstration of sampling variation

View source: R/rp-sample.r

rp.sampleR Documentation

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.

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.

Value

Nothing is returned.

References

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

Examples

## Not run: 
   rp.sample()

## End(Not run)

rpanel documentation built on Feb. 16, 2023, 10:37 p.m.

Related to rp.sample in rpanel...