anm.coin: Animated demonstration of frequentist binomial convergence of...

anm.coinR Documentation

Animated demonstration of frequentist binomial convergence of probability using a coin flip.

Description

Creates an animated plot showing the results from coin flips, and the resulting convergence in P(Head) as the number of flips grows large.

Usage

anm.coin(flips = 1000, p.head = 0.5, interval = 0.01, show.coin = TRUE, ...)
anm.coin.tck()

Arguments

flips

The number of desired coin flips.

p.head

User defined probability of a head; e.g., for a fair coin p.head = 0.5.

interval

The time between animation frames, in seconds.

show.coin

Logical if show.coin=TRUE shows a second plot with coin flip results (head or tail).

...

Additional arguments to plot.

Value

If show.coin=TRUE, returns two plots configured as a single graphical object. The first plot shows convergence in estimated P(Head), i.e., number of heads/number of trials, as the number of trials grows large. The second plot shows individual outcomes of coin flips. The second (smaller) plot is not returned if show.coin=TRUE is specified. Loading tcltk allows use of the function anm.coin.tck, which creates an interactive GUI to run anm.coin.

Author(s)

Ken Aho

See Also

rbinom

Examples

## Not run: anm.coin()

asbio documentation built on May 29, 2024, 5:57 a.m.