ciSim {NCStats}R Documentation

A dynamic graph to illustrate the concept of confidence intervals for a mean.


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.


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



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


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


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


A single numeric that indicates the standard deviation of the known normal 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. If the user is not using RStudio or the manipulate package is not installed, then an attempt is made to produce the dynamic graph with Tcl/Tk using the functions in the relax package.


None, but a dynamic graphic with sliders is produced.


## Not run: 
# Default using normal theory for confidence regions
# Using t-distribution theory for confidence regions

## End(Not run)

[Package NCStats version 0.4.7 Index]