({{, (RefLink[NegativeMultinomialDistribution, paclet:ref/NegativeMultinomialDistribution])[n,p]
represents a negative multinomial distribution with parameter n and failure probability vector p.}})

OpenersNotesSection(Spacer1)Details

The probability for a vector x of non-negative integers (Subscript[x, 1]), (Subscript[x, 2]), …, (Subscript[x, m]), where m is the length of p in a negative multinomial distribution, is proportional to (n-1+Σ (Subscript[x, i])) ! Π(((Subscript[p, i])^(Subscript[x, i]))/ (Subscript[x, i]) ! ) .

The parameter n can be any positive real number, and p can be any vector of non-negative real numbers that sum to less than unity.

If n is a positive integer, (RefLink[NegativeMultinomialDistribution, paclet:ref/NegativeMultinomialDistribution])[n,p] gives the distribution of the failure counts in a sequence of trials with success probability 1-(RefLink[Total, paclet:ref/Total])[p] and (RefLink[Length, paclet:ref/Length])[p] types of failure before n successes occur.

(RefLink[NegativeMultinomialDistribution, paclet:ref/NegativeMultinomialDistribution]) allows n and components of vector p to be dimensionless quantities. »

(RefLink[NegativeMultinomialDistribution, paclet:ref/NegativeMultinomialDistribution]) can be used with such functions as (RefLink[Mean, paclet:ref/Mean]), (RefLink[CDF, paclet:ref/CDF]), and (RefLink[RandomVariate, paclet:ref/RandomVariate]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (20)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Probability mass function:

Table[DiscretePlot3D[PDF[NegativeMultinomialDistribution[n,{0.2,0.4}],{x,y}],{x,0,n+5},{y,0,n+5},ExtentSize->0.5,PlotRange->All,PlotLabel->Row[{"n = ",n}]],{n,{5,10,15,20}}]

PDF[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}],{x,y}]

Cumulative distribution function:

Table[DiscretePlot3D[CDF[NegativeMultinomialDistribution[n,{0.2,0.4}],{x,y}],{x,0,n+5},{y,0,n+5},ExtentSize->Right,PlotRange->All,PlotLabel->Row[{"n = ",n}]],{n,{5,10,15,20}}]

Mean and variance:

Mean[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]]

Variance[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]]

Covariance:

Covariance[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]]//MatrixForm

OpenersExampleSection1(Spacer1)Scope  (9)

Generate a sample of pseudorandom vectors from a negative multinomial distribution:

sample=RandomVariate[𝒹=NegativeMultinomialDistribution[20,{.2,.3}],10^4];

Row[{Histogram3D[sample,{-0.5,20.5,1},"PDF",ColorFunction->"Rainbow"],DiscretePlot3D[PDF[𝒹,{x,y}],{x,0,20},{y,0,20},ColorFunction->"Rainbow",PlotRange->All,ExtentSize->1]}]

Distribution parameters estimation:

s=RandomVariate[NegativeMultinomialDistribution[20,{.2,.3}],10^2];

Estimate the distribution parameters from sample data:

e𝒟=EstimatedDistribution[s,NegativeMultinomialDistribution[n,{p1,p2}]]

Goodness-of-fit test:

DistributionFitTest[s,e𝒟]

Skewness:

Plot3D[Skewness[NegativeMultinomialDistribution[10,{p1,p2}]][[1]],{p1,0,.5},{p2,0,0.5},MeshFunctions->{#3&},MeshShading->ColorData[35,"ColorList"],AxesLabel->Automatic,ViewPoint->{1,2,0.5}]

Skewness[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]]

Limit[Skewness[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]],n->∞]

Kurtosis:

Plot3D[Kurtosis[NegativeMultinomialDistribution[10,{p1,p2}]][[1]],{p1,0,.5},{p2,0,0.5},MeshFunctions->{#3&},MeshShading->ColorData[35,"ColorList"],AxesLabel->Automatic,ViewPoint->{1,2,0.5}]

Kurtosis[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]]

Limit[Kurtosis[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]],n->∞]

Correlation:

Correlation[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]]//FullSimplify[#,(Subscript[p, 1])>0&&(Subscript[p, 2])>0]&//MatrixForm

Different mixed moments for a bivariate negative multinomial distribution:

FormulaGrid[list_,type_]:=Grid[Transpose[{list}],Alignment->{Left,Automatic},Background->{None,{{Lighter[Blend[Switch[type,M,{Blue,Green},CM,{Red,Orange},FM,{Magenta,Cyan},C,{Purple,Red}]],.8],White}}},Dividers->{None,{Darker[Gray,.6],{False},Darker[Gray,.6]}},ItemSize->35]

FormulaGrid[Table[Moment[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}],{2,k}]//FullSimplify,{k,0,4}],M]

Mixed central moments:

FormulaGrid[Table[CentralMoment[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}],{3,k}]//FullSimplify,{k,0,4}],CM]

Mixed factorial moments:

FormulaGrid[Table[FactorialMoment[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}],{2,k}]//FullSimplify,{k,0,4}],FM]

Closed form for a symbolic order:

FactorialMoment[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}],{r,k}]

Mixed cumulants:

FormulaGrid[Table[Cumulant[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}],{2,k}]//FullSimplify,{k,0,4}],C]

Hazard function:

Table[DiscretePlot3D[HazardFunction[NegativeMultinomialDistribution[n,{0.2,0.4}],{x,y}],{x,0,n+5},{y,0,n+5},ExtentSize->0.5,PlotRange->All,PlotLabel->Row[{"n = ",n}]],{n,{5,10,15,20}}]

Univariate marginals give (RefLink[NegativeBinomialDistribution, paclet:ref/NegativeBinomialDistribution]):

𝒟=NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2]),(Subscript[p, 3])}];

ℳ1=MarginalDistribution[𝒟,3]

DiscretePlot[PDF[ℳ1/.{n->5,(Subscript[p, 1])->.2,(Subscript[p, 2])->.3,(Subscript[p, 3])->.4},x]//Evaluate,{x,0,30},ExtentSize->1/2]

Multivariate marginals give (RefLink[NegativeMultinomialDistribution, paclet:ref/NegativeMultinomialDistribution]):

ℳ2=MarginalDistribution[𝒟,{1,2}]

DiscretePlot3D[PDF[ℳ2/.{n->5,(Subscript[p, 1])->.2,(Subscript[p, 2])->.3,(Subscript[p, 3])->.4},{x,y}]//Evaluate,{x,0,20},{y,0,30},ExtentSize->1/2]

Use dimensionless (RefLink[Quantity, paclet:ref/Quantity]) to define (RefLink[NegativeMultinomialDistribution, paclet:ref/NegativeMultinomialDistribution]):

NegativeMultinomialDistribution[Quantity[1.2,"Gross"],Quantity[{10,20,30},"Percent"]]

OpenersExampleSection2(Spacer1)Applications  (1)

Find the distribution for the number of times a biased coin should be flipped until you get heads twice in a row. If you let p be the probability of heads, the two events for which you start over are "T" (tail) or "HT" (head, tail) and the event for which you succeed is "HH" (head, head). These events have the following probabilities:

pr["T"]=(1-p);
pr["HT"]=p(1-p);
pr["HH"]=(p^2);

The total number of coin flips until two heads:

𝒟=TransformedDistribution[x+2y+2,{x,y}\[Distributed]NegativeMultinomialDistribution[1,{pr["T"],pr["HT"]}]];

Find the probability that no more than five coin flips are required:

Probability[coinflip<=5,coinflip\[Distributed]𝒟]

Plot[%,{p,0,1},Filling->Axis]

OpenersExampleSection3(Spacer1)Properties & Relations  (3)

The components are correlated:

Correlation[NegativeMultinomialDistribution[n,{(Subscript[p, 1]),(Subscript[p, 2])}]]//FullSimplify//MatrixForm

Solve[(((Subscript[p, 1]) (Subscript[p, 2]))/((Sqrt[-(Subscript[p, 1]) (-1+(Subscript[p, 2]))]) (Sqrt[-(-1+(Subscript[p, 1])) (Subscript[p, 2])])))==0,(Subscript[p, 1])]

Relationships to other distributions:

A univariate negative multinomial distribution is a negative binomial distribution:

PDF[NegativeMultinomialDistribution[n,{1-p}],{x}]

PDF[NegativeBinomialDistribution[n,p],x]

FullSimplify[%-%%]

OpenersExampleSection4(Spacer1)Possible Issues  (3)

(RefLink[NegativeMultinomialDistribution, paclet:ref/NegativeMultinomialDistribution]) is not defined when n is not a positive integer:

Mean[NegativeMultinomialDistribution[-2,{(Subscript[p, 1]), (Subscript[p, 2]),(Subscript[p, 3]),(Subscript[p, 4])}]]

(RefLink[NegativeMultinomialDistribution, paclet:ref/NegativeMultinomialDistribution]) is not defined when p is not a vector of probabilities that sum to less than 1:

Mean[NegativeMultinomialDistribution[n,{1/2,2}]]

Substitution of invalid parameters into symbolic outputs gives results that are not meaningful:

Mean[NegativeMultinomialDistribution[n,{(Subscript[p, 1]), (Subscript[p, 2]),(Subscript[p, 3])}]]/.{n->-5,(Subscript[p, 1])->1/2, (Subscript[p, 2])->2,(Subscript[p, 3])->I}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[NegativeBinomialDistribution, paclet:ref/NegativeBinomialDistribution])  ▪  (RefLink[MultinomialDistribution, paclet:ref/MultinomialDistribution])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Urn Model Distributions, paclet:guide/UrnModelDistributions])}, {▪(RefLinkPlain[Parametric Statistical Distributions, paclet:guide/ParametricStatisticalDistributions])}})}})