plotBinom {LearningStats} | R Documentation |
Probability Mass and/or Distribution Function Representations associated with a Binomial Distribution
Description
plotBinom
represents the probability mass and/or the distribution function associated with a Binomial
distribution with certain parameters n
and p
.
Usage
plotBinom(n, p, type = "b", col = "grey")
Arguments
n |
the number of independent Bernoulli trials. |
p |
the probability of success associated with the Bernoulli trial. |
type |
a character string giving the type of desired plot. The following values are possible: "b" (default) for probability mass function and distribution function representations together, "d" for distribution function representation and "p" for probability mass function representation. |
col |
a single colour associated with the probability mass function representation; default to "grey". |
Details
Note that if n=1
, the Binomial distribution is also known as Bernoulli distribution.
Value
A matrix containing the probability mass and the distribution function associated with each point
of the support of a Binomial distribution with parameters n
and p
.
This function is called for the side effect of drawing the plot.
Examples
n=10;p=0.3
plotBinom(n,p,type="d")
plotBinom(n,p,type="p",col="pink")
plotBinom(n,p)