AproxBinomNorm {LearningStats}R Documentation

Illustration of the Normal approximation to Binomial

Description

When certain conditions are met (see Details), the Binomial distribution can be approximated by the Normal one. The function AproxBinomNorm illustrates this fact by plotting the mass diagram corresponding with the discrete distribution (parameters are given by the user) on which the associated Normal density function is also displayed.

Usage

AproxBinomNorm(n, p, legend = TRUE, xlab = "", ylab = "Probability",
  main = "Normal approximation to Binomial", col.fill = "grey",
  col.line = "red", lwd = 2)

Arguments

n

number of independent Bernouilli trials.

p

probability of success associated with the Bernouilli trial.

legend

logical argument indicating whether to display the legend on the plot or not, default to TRUE.

xlab

x-axis label; default to empty.

ylab

y-axis label; default to "Probability."

main

title; default to "Normal approximation to Binomial".

col.fill

colour to fill-in the bars; default to grey.

col.line

colour to draw the line of the Normal density; default to red.

lwd

line width for the Normal density, a positive number; default to 2.

Details

The approximation is accurate only if one of these three conditions is met:

- p in (0.1, 0.9) and n>=30,

- p in [0,0.1] and np>5,

- p in [0.9,1] and n(1-p)>5.

Value

This function is called for the side effect of drawing the plot.

Examples

n=45; p=0.4
AproxBinomNorm(n,p)
AproxBinomNorm(n,p,col.fill="blue",col.line="orange")
AproxBinomNorm(n,p,legend=FALSE)


[Package LearningStats version 0.1.0 Index]