ciSim: A dynamic graph to illustrate the concept of confidence...

Description Usage Arguments Details Value Examples

View source: R/sims-teaching.R

Description

This function demonstrates the concept of confidence regions by drawing a large number of random samples from a known normal distribution, computing a confidence interval for each sample, and plotting those confidence intervals. Sliders then let the user change the level of confidence, the sample size, or the type of confidence region (interval or bound) to see how that effects the confidence interval widths (margin-of-error) and capture probability.

Usage

1
ciSim(reps = 200, method = c("Z", "t"), mu = 100, sigma = 10)

Arguments

reps

A single numeric that indicates the number of replicate samples to draw from the population

method

A single string that indicates whether to make confidence intervals using a normal (="Z") or t (="t") distribution

mu

A single numeric that indicates the mean of the known normal distribution

sigma

A single numeric that indicates the standard deviation of the known normal distribution

Details

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 graphic with sliders is produced (if using RStudio).

Examples

1
2
3
4
5
6
7
## Not run: 
# Default using normal theory for confidence regions
ciSim()
# Using t-distribution theory for confidence regions
ciSim(method="t")

## End(Not run)

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