Learn R Programming

lessR (version 2.1.1)

sim.binomial: Pedagogical Binomail Simulation, Coin Flips

Description

Simulate a sequence of coin flips.

Usage

sim.binomial(n, prob=.5, show.title=TRUE, pdf.out=FALSE, 
             show.flips=TRUE, col.grid="grey90", pause=FALSE)

Arguments

n
Size of each sample.
prob
Probability of a success on any one trial.
show.title
Place a title on the graph that contains the parameter values.
pdf.out
Generate a pdf file with an appropriate title.
show.flips
Plot the outcome of each flip.
col.grid
Color of the grid lines.
pause
Build the graph and the text output confidence interval by confidence interval.

Details

Generate and plot successive values of a Head or a Tail using standard R rbinom function.

Examples

Run this code
# 10 flips of a fair coin
sim.binomial(10, .5)

Run the code above in your browser using DataLab