cltSim: A dynamic graph to illustrate the Central Limit Theorem.

Description Usage Arguments Details Value Examples

View source: R/sims-teaching.R

Description

A dynamic graph to illustrate the central limit theorem (CLT). The user can change the population distribution that is sampled from and the sample size.

Usage

1
cltSim(reps = 5000, incl.norm = FALSE)

Arguments

reps

Number of resamples to take from the population distribution and means to calculate

incl.norm

A logical that indicates whether a normal density curve should be superimposed on the sampling distribution

Details

This function produces two graphics. The left graphic is a histogram of the individuals in the population and the right graphic is a histogram of the simulated sampling distribution (i.e., means from the multiple samples). The right graphic may include a normal distribution density curve with incl.norm=TRUE.

The two graphs are dynamically controlled by three sliders. The first two sliders control the shape parameters of the beta distribution used to model the population distribution sampled from. A wide variety of shapes may be created with these two shape parameters. The third slider controls the size of each sample taken from the population distribution. The sliders may be used to detect how changes in the shape of the population and the size of the sample effect the shape, center, and dispersion of the sampling distribution.

If the user is using RStudio and the manipulate package is installed then the dynamic graph is produced in the “Plots” pane of RStudio. The plot controls may be accessed through the “gear” that is in the upper-left corner of the plot.

Value

None, but a dynamic graph with sliders is produced (if using RStudio).

Examples

1
2
3
4
## Not run: 
cltSim()

## End(Not run)

droglenc/NCStats documentation built on June 5, 2021, 2:06 p.m.