The Negative Binomial Distribution (or Pascal Distribution)

The negative binomial distribution describes the number of trials needed to achieve a certain number of successes in a series of independent trials. For example, it could be used to calculate the probability of getting three heads when flipping a coin 5 times, assuming the coin is balanced and therefore the probability of getting heads on each flip is 50%.

The negative binomial distribution is useful in many fields, including statistics, economics, biology, and physics. And also in “our” SEO.

Defining the Negative Binomial Distribution (or Pascal Distribution)

The negative binomial distribution is a discrete probability distribution that describes the number of trials needed to achieve a certain number of successes in a series of independent trials.

A trial is said to succeed with probability p, and we want to achieve a total of r successes. The negative binomial distribution provides the probability of achieving r successes in the first n trials.

The parameters used in the negative binomial distribution are:

  • the probability of success p, which indicates the probability of achieving a success in a single trial.
  • the desired number of successes r, which indicates the total number of successes we want to achieve.
  • the number of trials needed n, which indicates the number of trials that must be conducted to achieve r successes.

The negative binomial distribution is often denoted with the following notation:

\( X \sim NB(r,p) \\ \)

where X indicates the number of trials needed to achieve r successes, and the symbol “~” means “distributed as”.

Examples of Using the Negative Binomial Distribution

The negative binomial distribution can be applied in various situations, for example:

  • In marketing, to calculate the number of attempts needed to achieve a certain number of sales or conversions.
  • In biology, to calculate the number of attempts needed to achieve a certain number of successes in a series of experiments (for example, the number of attempts needed to isolate a specific bacterial strain).
  • In engineering, to calculate the number of repetitions needed to test the resistance of a material or structure.

To calculate the probability of achieving r successes in the first n trials, we can use the following formula:

\( P(X = n) = {n-1 \choose r-1} p^r (1-p)^{n-r} \\ \)

where X indicates the number of trials needed to achieve r successes, p indicates the probability of success in a single trial, and C indicates the binomial coefficient.

For example, suppose we want to calculate the probability of getting 3 heads when flipping a fair coin (probability of success p=0.5). If we assume that 5 flips are needed to get 3 heads, we can use the negative binomial distribution to calculate the probability of success:

\( P(X = 5) = {4 \choose 2} \cdot 0.5^3 \cdot 0.5^2 = 0.1875 \\ \)

This means that the probability that the third head arrives exactly on the fifth flip is 18.75%.

Negative binomial(r=3, p=0.5): with a fair coin, the probability that it takes exactly n flips to get 3 heads. The highlighted bar is the worked example, P(X=5) = 0.1875.

Differences Between the Geometric Distribution and Pascal Distribution

The geometric is the r=1 case of the negative binomial: it counts trials to the FIRST success. Asking for 3 (r=3) shifts the distribution to the right and takes longer on average.

The negative binomial distribution and the geometric distribution are both discrete probability distributions used to model the number of trials needed to achieve a certain number of successes. However, the two distributions differ in the definition of success and the modeling objective.

The geometric distribution is used to model the number of trials needed to achieve the first success in a sequence of independent identically distributed trials. For example, the probability of achieving the first success in a fair coin toss can be modeled with a geometric distribution, where the probability of success is p=0.5 and the number of trials needed can take the values 1, 2, 3, ….

In more precise terms:

The main difference between the geometric distribution and the Pascal distribution is that the geometric distribution represents the total number of attempts needed to achieve one success, while the Pascal distribution represents the number of failures before the k-th success in a succession of independent and identically distributed Bernoulli experiments.

In other words, the geometric distribution describes the time needed to achieve the first success, while the Pascal distribution describes the time needed to achieve a certain fixed number of successes. Moreover, the geometric distribution has only one parameter (the probability of success), while the Pascal distribution has two parameters (the desired number of successes and the probability of success).

The formulas for the negative binomial distribution and the geometric distribution are similar, but with some differences in parameters and modeling objective.

For example, let’s consider the case of a fair coin with p=0.5. The probability of achieving the first success in 3 trials can be calculated with a geometric distribution:

\( P(X = 3) = (1-0.5)^2 \cdot 0.5 = 0.125 \\ \)

where X indicates the number of trials needed to achieve the first success.

On the other hand, the probability of achieving 3 successes in 5 trials can be calculated with a negative binomial distribution:

\( P(X = 5) = {4 \choose 2} \cdot 0.5^3 \cdot 0.5^2 = 0.1875 \\ \)

where X indicates the number of trials needed to achieve 3 successes.

Links to Authoritative Resources for Further Study


Further Reading

For an orderly path through the discrete distributions — binomial, geometric, negative binomial — Finalmente ho capito la statistica by Maurizio De Pra (Italian edition) is an accessible companion with plenty of worked examples.

paolo

Recent Posts

Keyword Clustering: grouping thousands of queries with K-means and hierarchical clustering

It happens with every reasonably serious project: you export the keyword list from Search Console…

1 month ago

Expected vs Actual CTR: finding the pages that earn fewer clicks than their position deserves

Anyone who spends their days inside Search Console knows that little nagging feeling: a page…

1 month ago

Naive Bayes: classifying search intent with Bayes’ theorem

In the article on the multi-armed bandit we used Bayes to decide between variants: shifting…

1 month ago

Multi-armed bandit: optimising the variants while the test is still running

In the article on Bayesian A/B testing we compared two variants at a fixed sample…

1 month ago

Bayesian A/B Testing: not just “whether” B beats A, but “by how much”

In the article on classic A/B testing we saw how to compare two variants with…

1 month ago

Bayesian Conversion Rate Estimation: how much can we trust limited data

In the article on the foundations of Bayesian statistics, we saw how Bayesian updating works…

1 month ago