Skip to content

NegativeBinomialDistribution ​

The negative binomial distribution: the number of failures before the nn-th success, with success probability pp.

NegativeBinomialDistribution(n, p)an inert distribution object — carries n,pn, p, unevaluated.
Typed signatures
TypePackageApplies
(real<0..>, real<0..1>) -> distributionstatisticsalways

Domain: Statistics

Details
  • PDF(k)=(n+k−1k)pn(1−p)kPDF(k) = \binom{n+k-1}{k} p^n (1-p)^k.
  • CDF(x)=Ip(n,⌊x⌋+1)CDF(x) = I_p(n, \lfloor x\rfloor + 1), the regularized incomplete beta, via BetaRegularized — the standard negative-binomial/incomplete-beta identity — clamped to 00 below x=0x=0.
  • Mean=n(1−p)/pMean = n(1-p)/p, Variance=n(1−p)/p2Variance = n(1-p)/p^2, both exact.
  • RandomVariate sums nn GeometricDistribution-style draws.

Examples

Basic #
live ↗
InPDF⁡(NegativeBinomialDistribution(5,13),2)\operatorname{PDF}(\mathrm{NegativeBinomialDistribution}(5, \frac{1}{3}), 2)Out20729\frac{20}{729}

Cross-checked against wolframscript's N[CDF[NegativeBinomialDistribution[5, 1/3], 2]]

live ↗
InCDF⁡(NegativeBinomialDistribution(5,13),2)\operatorname{CDF}(\mathrm{NegativeBinomialDistribution}(5, \frac{1}{3}), 2)OutBetaRegularized⁡(13,5,3)\operatorname{BetaRegularized}(\frac{1}{3}, 5, 3)
live ↗
Inmean(NegativeBinomialDistribution(5,13))\mathrm{mean}(\mathrm{NegativeBinomialDistribution}(5, \frac{1}{3}))Out1010
live ↗
InVariance(NegativeBinomialDistribution(5,13))\mathrm{Variance}(\mathrm{NegativeBinomialDistribution}(5, \frac{1}{3}))Out3030
Scope #
live ↗
InCDF⁡(NegativeBinomialDistribution(20,N(13,30)),5)\operatorname{CDF}(\mathrm{NegativeBinomialDistribution}(20, N(\frac{1}{3}, 30)), 5)Out0.000 002 268 661 443 783 180 826 880.000\,002\,268\,661\,443\,783\,180\,826\,88
live ↗
InPDF⁡(NegativeBinomialDistribution(20,N(13,30)),5)\operatorname{PDF}(\mathrm{NegativeBinomialDistribution}(20, N(\frac{1}{3}, 30)), 5)Out0.000 001 605 271 196 663 597 373 910 574 262 795 274 399 330 079 520.000\,001\,605\,271\,196\,663\,597\,373\,910\,574\,262\,795\,274\,399\,330\,079\,52
About
Examples6
Checked againstWolfram Language 2 agree

See also: GeometricDistribution, BinomialDistribution, PDF, CDF