Negative Binomial Distribution

In connection with repeated Bernoulli trials, we are sometimes interested in the number of the trial on which the k-th success occurs.

A random variable X has a negative binomial distribution and it is referred to as a negative binomial random variable if and only if its probability distribution is given by
\[ b(x; k, \theta ) = \binom{x-1}{k-1} \theta^k \left( 1 - \theta \right)^{x-k} \qquad \mbox{ for } \ x=k,k+11,k+2,\ldots . \]
R has four dedicated commands for density, distribution function, quantile function, and random generation for the negative binomial distribution with parameters size and prob: