# NegativeBinomialDistribution

represents a negative binomial distribution with parameters n and p.

# Examples

open allclose all

## Basic Examples(3)

Probability mass function:

Cumulative distribution function:

Mean and variance:

## Scope(8)

Generate a sample of pseudorandom numbers from a negative binomial distribution:

Compare its histogram to the PDF:

Distribution parameters estimation:

Estimate the distribution parameters from sample data:

Compare the density histogram of the sample with the PDF of the estimated distribution:

Skewness:

For large n, the distribution becomes more symmetric:

Limiting values:

Kurtosis:

For large values of n, kurtosis gets close to the kurtosis of the standard NormalDistribution:

Limiting values:

Different moments with closed forms as functions of parameters:

Closed form for symbolic order:

Hazard function:

Quantile function:

Use dimensionless Quantity to define NegativeBinomialDistribution:

## Applications(7)

The CDF of NegativeBinomialDistribution is an example of a right-continuous function:

The number of tails before getting 4 heads with a fair coin:

Plot the distribution of tail counts:

Compute the probability of getting at least 6 tails before getting 4 heads:

Compute the expected number of tails before getting 4 heads:

A coin was flipped 10 times and the 8 head occurred at the 10 flip. Find the probability of such an event if the coin is fair:

Assuming the coin may not be fair, find the most likely value for :

A basketball player shoots free throws until he hits 4 of them. His probability of scoring in any one of them is 0.7. Simulate the process:

Find the number of shots the player is expected to shoot:

Find the probability that the player requires 4 shots:

Assume the probability of fouling for each minute interval is 0.1 independently. Simulate the fouling process for 30 minutes:

A basketball player fouls out after 6 fouls. Find the expected playing time until foul out:

A shipment of products is inspected in batches of 60 and each batch is inspected up to rejection when the 10 defective item is found. Find the probability of a batch being rejected if 20% of the items are defective:

Alternatively, compute the same result by truncating the distribution:

Simulate the number of non-defective products in rejected batches:

Illustrate the ratio in each batch:

Find the average ratio of non-defective to defective products in rejected batches:

A data stream containing data packets is repeatedly sent without order information. Find the distribution of the number of unordered data stream arrivals until all the packets arrive in the right order for the second time:

Find the probability that packets will arrive the second time in the correct order after at most 18 fails:

Find the average number of fails until the second ordered data stream:

Simulate the number of fails until the second ordered data stream:

## Properties & Relations(11)

converges to a normal distribution when n->:

Negative binomial distribution is closed under addition:

The limit of negative binomial distribution when the mean is fixed is PoissonDistribution:

Relationships to other distributions:

Negative binomial distribution simplifies to GeometricDistribution:

Negative binomial distribution and PascalDistribution differ by a shift:

Sum of n independent variables from GeometricDistribution has negative binomial distribution:

General proof for an arbitrary number of sum components:

A univariate NegativeMultinomialDistribution is a negative binomial distribution:

NegativeBinomialDistribution is a mixture of PoissonDistribution and GammaDistribution:

BetaNegativeBinomialDistribution is a mixture of negative binomial distribution and BetaDistribution:

NegativeBinomialDistribution is a special case of CompoundPoissonDistribution:

The parameters are given by:

Plot the probability density functions:

## Possible Issues(2)

NegativeBinomialDistribution is not defined when n is non-positive:

NegativeBinomialDistribution is not defined when p is not between zero and one:

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

Wolfram Research (2007), NegativeBinomialDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/NegativeBinomialDistribution.html (updated 2016).

#### Text

Wolfram Research (2007), NegativeBinomialDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/NegativeBinomialDistribution.html (updated 2016).

#### CMS

Wolfram Language. 2007. "NegativeBinomialDistribution." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/NegativeBinomialDistribution.html.

#### APA

Wolfram Language. (2007). NegativeBinomialDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NegativeBinomialDistribution.html

#### BibTeX

@misc{reference.wolfram_2024_negativebinomialdistribution, author="Wolfram Research", title="{NegativeBinomialDistribution}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/NegativeBinomialDistribution.html}", note=[Accessed: 13-September-2024 ]}

#### BibLaTeX

@online{reference.wolfram_2024_negativebinomialdistribution, organization={Wolfram Research}, title={NegativeBinomialDistribution}, year={2016}, url={https://reference.wolfram.com/language/ref/NegativeBinomialDistribution.html}, note=[Accessed: 13-September-2024 ]}