Binomial {base} | R Documentation |
The Binomial Distribution
Description
These functions provide information about the binomial distribution
with parameters size
and prob
. dbinom
gives the density,
pbinom
gives the distribution function qbinom
gives
the quantile function and rbinom
generates random deviates.
Usage
dbinom(x, size, prob)
pbinom(q, size, prob)
qbinom(p, size, prob)
rbinom(n, size, prob)
Arguments
x , q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations to generate. |
size |
number of trials. |
prob |
probability of success on each trial. |
Details
The binomial distribution with size
= n
and
prob
= p
has density
p(x) = {n \choose x} {p}^{x} {(1-p)}^{n-x}%
for x = 0, \ldots, n
.
If an element of x
is not integer, the result of dbinom
is zero,
with a warning.
The quantile is left continuous: qbinom(q, ...)
is the largest
integer x such that P(X <= x) < q.
See Also
dnbinom
for the negative binomial, and dpois
for the Poisson distribution.
Examples
# Compute P(45 < X < 55) for X Binomial(100,0.5)
sum(dbinom(46:54, 100, 0.5))