Learn R Programming

CarletonStats (version 2.2)

confIntDemo: Confidence Interval Demonstration

Description

Draw many random samples and compute confidence interval. How many intervals capture the true mean?

Usage

confIntDemo(distr = "normal", size = 20, conf.level = 0.95)

Value

The command invisibly returns the fraction of intervals that capture the true mean.

Arguments

distr

distribution of the population to be sampled. Options include "normal", "exponential", "uniform" and "binary" (partial match allowed).

size

sample size

conf.level

confidence level.

Author

Laura Chihara

Details

This simulation will draw 100 random samples from a given population distribution and compute the correpsonding confidence intervals. The 100 intervals will be drawn with an indication of the ones that missed the true mean. A histogram of the population will also be created.

Examples

Run this code

confIntDemo()

confIntDemo(distr = "exponential", size = 40)


Run the code above in your browser using DataLab