This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/NegBinomial.html
NegBinomial {base}R Documentation

The Negative Binomial Distribution

Description

These functions provide information about the negative binomial distribution with parameters n and p. dnbinom gives the density, pnbinom gives the distribution function, qnbinom gives the quantile function and rnbinom generates random deviates.

The negative binomial distribution has density

p(x) = {x+n-1 \choose x} p^n (1-p)^x

for x = 0, 1, 2, \ldots

Usage

dnbinom(x, n, p)
pnbinom(q, n, p)
qnbinom(prob, n, p)
rnbinom(nobs, n, p)

See Also

dbinom for the binomial and dpois for the Poisson distribution.

Examples

x <- 0:11
dnbinom(x, n = 1, p = 1/2) * 2^(1 + x) # == 1
126 /  dnbinom(0:8, n = 2, p = 1/2) #- theoretically integer
## Cumulative ('p') = Sum of discrete prob.s ('d');  Relative error 
summary(1 - cumsum(dnbinom(x, n = 2, p = 1/2)) / pnbinom(x, n = 2, p = 1/2))

[Package base version 0.60 ]