Learn R Programming

asbio (version 1.9-7)

anm.ci: Animation demonstrations of confidence intervals.

Description

Provides animated depictions of confidence intervals for \(\mu\), \(\sigma^{2}\), the population median, and the binomial parameter \(\pi\).

Usage

anm.ci(parent=expression(rnorm(n)), par.val, conf = 0.95, sigma = NULL, 
  par.type = c("mu", "median", "sigma.sq", "p"), n.est = 100, 
  n = 50, err.col = 2, par.col = 4, interval = 0.1, ...) 

anm.ci.tck()

Value

Returns an animated plot.

Arguments

parent

A parental distribution; ideally a distribution with known parameters.

par.val

True parameter value which is being estimated.

conf

Confidence level: 1-P(type I error).

sigma

\(\sigma\) from the normal pdf, if known.

par.type

The parameter whose confidence intervals to be estimated. There are currently four choices c("mu", "median", "sigma.sq", "p"). These are the normal pdf parameters \(\mu\) and \(\sigma^{2}\), the population median, and the binomial parameter, \(\pi\).

n.est

The number of confidence intervals to be created.

n

The sample size used for each confidence interval.

err.col

The line color of the intervals which do not include the true value.

par.col

The line color denoting the parameter value.

interval

The time interval for animation (in seconds). Smaller intervals speed up animation

...

Additional arguments to plot.

Author

Ken Aho

Details

Provides an animated plot showing confidence intervals with respect to a known parameter. Intervals which do not contain the parameter are emphasized with different colors. Loading package tcltk allows use of function anm.ci.tck which provides an interactive GUI to run the function.

See Also

Additional documentation for methods provided in: ci.mu.t, ci.mu.z, ci.median, ci.sigma, and ci.p.

Examples

Run this code
if (FALSE) {
parent<-rnorm(100000)
anm.ci(parent, par.val=0, conf =.95, sigma =1, par.type="mu")
anm.ci(parent, par.val=1, conf =.95, par.type="sigma.sq")
anm.ci(parent, par.val=0, conf =.95, par.type="median")
parent<-rbinom(100000,1,p=.65)
anm.ci(parent, par.val=0.65, conf =.95, par.type="p")
##Interactive GUI, requires package 'tcltk'
anm.ci.tck()
}

Run the code above in your browser using DataLab