These functions demonstrate the concept of confidence intervals by
taking multiple samples from a known normal distribution and
calculating a confidence interval for each sample and plotting the
interval relative to the true mean. Intervals that contain the true
mean will be plotted in black and those that do not include the true
mean will be plotted in different colors.
The method
argument determines the type of interval: 'z' will
use the normal distribution and the known population standard
deviation, 't' will use the t distribution and the sample standard
deviations, 'both' will compute both for each sample for easy
comparison (it is best to reduce reps
to about 25 when using
'both').
The optional arguments lower.conf
and upper.conf
can be
used to plot non-symmetric or 1 sided confidence intervals.
The function run.ci.examp
also creates a Tk slider that will
allow you to interactively change the confidence level and replot the
intervals to show how the interval widths change with the confidence
level.