Negative Binomial Distribution

Author

Eric W. Weisstein
April 2, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Statistics/NegativeBinomialDistribution.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/NegativeBinomialDistribution.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Statistics

Stats[NegativeBinomialDistribution[r,p],x]//StatsForm//TraditionalForm

Plot

FullSimplify[PDF[NegativeBinomialDistribution[r,(1/2)],x],x>1&&r>1]

FullSimplify[FunctionExpand[%]]

Table[PDF[NegativeBinomialDistribution[r,(1/2)],x],{x,},{r,5}]

Plus@@@%

PDF and CDF

PDF[NegativeBinomialDistribution[r,p],x]

Sum[PDF[NegativeBinomialDistribution[r,p],x],{x,0,∞}]

FullSimplify[Sum[PDF[NegativeBinomialDistribution[r,p],x],{r,x}],0<p<1&&x>0&&x∈Integers]

FullSimplify[Sum[PDF[NegativeBinomialDistribution[r,p],y],{y,0,x}],x∈Integers&&0<p<1&&0<x<r]

CDF[NegativeBinomialDistribution[r,p],x]

Subtract@@@Table[{1-(((((1-p))^(1+x)) (p^r) Gamma[1+r+x] Hypergeometric2F1Regularized[1,1+r+x,2+x,1-p])/(Gamma[r])),BetaRegularized[p,r,1+x]}/.{p->Random[],x->Random[Integer,{1,10}],r->Random[Integer,{1,10}]},{10}]//Chop

Moment-Generating Function

Simplify[Sum[Exp[x t]Binomial[x+r-1,r-1](p^r)(((1-p))^x),{x,0,∞}]]

Simplify[Sum[Exp[x t]Binomial[x+r-1,x](p^r)(((1-p))^x),{x,0,∞}]]

Raw Moments

M[t_]:=(((1+(E^t) (-1+p)))^(-r)) (p^r)

m=NestList[D[#,t]&,M[t],4]/.t->0;

Table[Sum[x^n Binomial[x+r-1,r-1](p^r)(((1-p))^x),{x,0,∞}],{n,0,4}]-m//Simplify

Simplify[m/.p->-q+1]/.q-1->-p//ColumnForm

FullSimplify[Factor[m/.p-1->-q]]//ColumnForm

Central Momemts

(Overscript[μ, ′])[n_]:=Sum[x^n Binomial[x+r-1,r-1](p^r)(((1-p))^x),{x,0,∞}]

μ[n_]:=Sum[Binomial[n,k](((-1))^(n-k))(Overscript[μ, ′])[k](((Overscript[μ, ′])[1])^(n-k)),{k,0,n}]

FullSimplify[μ/@Range[4]]//ColumnForm

-(((-1+p) r Expand[((p^2)+3 (2+r)-3 p (2+r))])/(p^4))

Mean

(Overscript[μ, ′])[1]/.p-1->-q

Variance

Factor[(Overscript[μ, ′])[2]-(((Overscript[μ, ′])[1])^2)]/.p-1->-q

Factor[μ[2]]/.p-1->-q

Skewness

FullSimplify[((μ[3])/((μ[2])^(3/2))),0<p<1&&r>1]/.r-p r->r q

Kurtosis

Together[FullSimplify[((μ[4])/((μ[2])^2))-3,0<p<1&&r>1]/.r-p r->r q]