Negative Binomial Distribution
Definition 1
Given and , a discrete probability distribution with the following probability mass function is called the Negative Binomial Distribution.
Basic Properties
Moment Generating Function
- [1]:
Mean and Variance
- [2]: If , then
Description
The negative binomial distribution is concerned with the number of trials needed for an event with a probability to occur times. For example, consider how many times one must flip a coin until it lands on heads twice. Given that the probability of landing on heads is , it would take about two flips to get heads once, and needing that to happen one more time gives us an expected value of .
Intuitively, the negative binomial distribution can be seen as a generalization of the geometric distribution with the number of successes generalized. In fact, when the number of successes is one, i.e., , it exactly becomes the geometric distribution.
Naming
The reason for calling it a negative binomial distribution is because the shape of its probability mass function is related to the negative binomial coefficient.
Theorem
Generalization of Geometric Distribution
- [b]: If and , then
Proof
[1]
Binomial Series: If , then for ,
Based on the binomial series, since ,
■
[2]
Using the concept of Generalization of Geometric Distributions.
■
[b]
When the probability mass function of a geometric distribution is defined as , its moment generating function is as follows: Since the random variables , which are mutually independent, follow , the moment generating function for is This is identical to the moment generating function for the negative binomial distribution , therefore
■
Code
Below is a Julia code to show the probability mass function of the negative binomial distribution as a gif.
@time using LaTeXStrings
@time using Distributions
@time using Plots
cd(@__DIR__)
x = 0:20
P = collect(0.2:0.01:0.8); append!(P, reverse(P))
animation = @animate for p ∈ P
scatter(x, pdf.(NegativeBinomial(5, p), x),
color = :black, markerstrokecolor = :black,
label = "r = 5, p = $(rpad(p, 4, '0'))", size = (400,300))
xlims!(0,20); ylims!(0,0.5); title!(L"\mathrm{pmf\,of\,NB}(5, p)")
end
gif(animation, "pmf5.gif")
animation = @animate for p ∈ P
scatter(x, pdf.(NegativeBinomial(10, p), x),
color = :black, markerstrokecolor = :black,
label = "r = 10, p = $(rpad(p, 4, '0'))", size = (400,300))
xlims!(0,20); ylims!(0,0.5); title!(L"\mathrm{pmf\,of\,NB}(10, p)")
end
gif(animation, "pmf10.gif")
Hogg et al. (2013). Introduction to Mathematical Statistcs(7th Edition): p145. ↩︎