Binomial Distribution

DESCRIPTION:
Density, cumulative probability, quantiles and random generation for the binomial discrete distribution.

USAGE:
dbinom(x, size, prob)
pbinom(q, size, prob)
qbinom(p, size, prob)
rbinom(n, size, prob)

OPTIONAL ARGUMENTS:
x:
vector of quantiles. Missing values (NAs) are allowed.
q:
vector of (positive) quantiles (number of successes obtained in size binomial trials with probability prob of success). Missing values (NAs) are allowed.
p:
vector of probabilities. Missing values (NAs) are allowed.
n:
sample size.
size:
vector of (positive integer) numbers of coin flips for which the Binomial distribution measures the number of heads.
prob:
vector of probabilities of a head. If length(n) is larger than 1, then length(n) random values are returned.

VALUE:
density (dbinom), probability (pbinom), quantile (qbinom), or random sample (rbinom) for the Binomial distribution with parameters size and prob. The quantile is defined as the smallest value q such that Pr(Binomial random variate <= x) >= p.

SIDE EFFECTS:
The function rbinom causes the creation of the dataset .Random.seed if it does not already exist, otherwise its value is updated.

DETAILS:
Elements of q or p that are missing will cause the corresponding elements of the result to be missing.

BACKGROUND:
A Binomial discrete random variable X is the number of successes in n independent repetitions of a simple success-failure experiment where p is the probability of success. For example, consider the experiment of tossing a coin n times where the probability of the coin landing heads is p. A special case is the Bernoulli trial when n == 1 (a coin toss).

REFERENCES:
Hoel, P., Port, S. and Stone, C. (1971). Introduction to Probability Theory. Houghton-Mifflin, Boston, MA.

Johnson, N. L. and Kotz, S. (1970). Discrete Univariate Distributions, vol. 2. Houghton-Mifflin, Boston, MA.


SEE ALSO:
NegBinomial , set.seed .

EXAMPLES:
rbinom(20,10,0.5)  # sample of size 20 with mean 10*0.5 = 5