Learn R Programming

lessR (version 3.7.6)

simCImean: Pedagogical Simulation for the Confidence Interval of the Mean

Description

Show a sequence of confidence intervals, all calculated from repeated samples of simulated data from the same normal population, and show which intervals contain the true population mean.

Usage

simCImean(ns, n, mu=0, sigma=1, cl=0.95, 
         ylim.bound=NULL, show.data=FALSE, show.title=TRUE, 
         miss.only=FALSE, color.hit="gray40", color.miss="red",
         grid="grey90", pause=FALSE,
         main=NULL, pdf.file=NULL, width=5, height=5, …)

Arguments

ns

Number of samples, that is, repetitions of the experiment.

n

Size of each sample.

mu

Population mean.

sigma

Population standard deviation.

cl

Confidence level.

ylim.bound

Specify the maximum deviation of the mean in either direction for the extent of the vertical axis.

show.data

Plot the data for each sample as well as the confidence interval.

show.title

Place a title on the graph that contains the parameter values.

miss.only

For the text output, only display information for samples that missed the mean.

color.hit

Color of the confidence intervals that contains the mean.

color.miss

Color of the confidence intervals that miss the mean.

grid

Color of the grid lines.

pause

Build the graph and the text output confidence interval by confidence interval.

main

Title of graph.

pdf.file

Name of the pdf file to which graphics are redirected.

width

Width of the pdf file in inches.

height

Height of the pdf file in inches.

Other parameter values, possibly invalid.

Details

Simulate random normal data and display the resulting confidence intervals.

Examples

Run this code
# NOT RUN {
# 25 confidence intervals with a sample size each of 100
# mu=0, sigma=1, that is, sample from the standard normal
simCImean(25, 100)

# 25 confidence intervals with a sample size each of 100
# mu=100, sigma=15
# pause after each interval and show the data
simCImean(25, 100, mu=100, sigma=15, show.data=TRUE)
# }

Run the code above in your browser using DataLab