## The Negative Binomial Distribution

## Usage

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

## Arguments

`x,q` | vector of quantiles representing the number of failures which occur in a sequence of Bernoulli trials before a target number of successes is reached.
`p` | vector of probabilities.
`n` | number of observations to generate.
`size` | target for number of successful trials.
`prob` | probability of success in each trial.

## Description

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

The negative binomial distribution with `size` = n and `prob` = p has density

p(x) = Choose(x+n-1,x) p^n (1-p)^x

for x = 0, 1, 2, ...

## See Also

`dbinom` for the binomial, `dpois` for the Poisson and `dgeom` for the geometric distribution, which is a special case of the negative binomial.

## Examples

    x <- 0:11
    dnbinom(x, size = 1, prob = 1/2) * 2^(1 + x) # == 1
    126 /  dnbinom(0:8, size  = 2, prob  = 1/2) #- theoretically integer

    ## Cumulative ('p') = Sum of discrete prob.s ('d');  Relative error :
    summary(1 - cumsum(dnbinom(x, size = 2, prob = 1/2)) /
    	          pnbinom(x, size  = 2, prob = 1/2))

[Package Contents]