Section 7.4 Negative Binomial
Consider the situation where one can observe a sequence of independent trials where the likelihood of a success on each individual trial stays constant from trial to trial. Call this likelihood the probably of "success" and denote its value by p where 0 \lt p \lt 1 \text{.} If we let the variable X measure the number of trials needed in order to obtain the rth success, r \ge 1\text{,} with R = \{r, r+1, r+2, ... \} then the resulting distribution of probabilities is called a Geometric Distribution.
Note that r=1 gives the Geometric Distribution.
Proof
First, convert the problem to a slightly different form: \(\frac{1}{(a+b)^n} = \frac{1}{b^n} \frac{1}{(\frac{a}{b}+1)^n} = \frac{1}{b^n} \sum_{k=0}^{\infty} {(-1)^k \binom{n + k - 1}{k} \left ( \frac{a}{b} \right ) ^k}\)
So, let's replace \(\frac{a}{b} = x\) and ignore for a while the term factored out. Then, we only need to show
However
This infinite sum raised to a power can be expanded by distributing terms in the standard way. In doing so, the various powers of x multiplied together will create a series in powers of x involving \(x^0, x^1, x^2, ...\text{.}\) To detemine the final coefficients notice that the number of time \(m^k\) will appear in this product depends upon the number of ways one can write k as a sum of nonnegative integers.
For example, the coefficient of \(x^3\) will come from the n ways of multiplying the coefficients \(x^3, x^0, ..., x^0\) and \(x^2, x^1, x^0, ..., x^0\) and \(x^1, x^1, x^1, x^0,..., x^0\text{.}\) This is equivalent to finding the number of ways to write the number k as a sum of nonnegative integers. The possible set of nonnegative integers is {0,1,2,...,k} and one way to count the combinations is to separate k *'s by n-1 |'s. For example, if k = 3 then *||** means \(x^1 x^0 x^2 = x^3\text{.}\) Similarly for k = 5 and |**|*|**| implies \(x^0 x^2 x^1 x^2 x^0 = x^5\text{.}\) The number of ways to interchange the identical *'s among the idential |'s is \(\binom{n+k-1}{k}\text{.}\)
Furthermore, to obtain an even power of x will require an even number of odd powers and an odd power of x will require an odd number of odd powers. So, the coefficient of the odd terms stays odd and the coefficient of the even terms remains even. Therefore,
Similarly, \(\left ( \frac{1}{1-x} \right )^n = \left ( \sum_{k=0}^{\infty} {x^k} \right )^n = \sum_{k=0}^{\infty} {\binom{n + k - 1}{k} x^k}\)
Consider the situation where one can observe a sequence of independent trials with the likelihood of a success on each individual trial p where 0 \lt p \lt 1 \text{.} For a positive integer r, let the variable X measure the number of trials needed in order to obtain the rth success. Then the resulting distribution of probabilities is called a Negative Binomial Distribution.
Theorem 7.4.2 Derivation of Negative Binomial Probability Function
Proof
Since successive trials are independent, then the probability of the rth success occurring on the x-th trial presumes that in the previous x-1 trials were r-1 successes and x-r failures. You can arrange these indistinguishable successes (and failures) in \(\binom{x-1}{r-1}\) unique ways. Therefore the desired probability is given by
Theorem 7.4.3 Negative Binomial Distribution Sums to 1
Proof
and by using \(k = x-r\)
Utilize the interactive cell below to compute f(x) and F(x) for the negative binomial distribution.
xxxxxxxxxx
# Negative Binomial calculator
def _(p=input_box(0.3,width=15),r=slider(1,10,1,2)):
n = 4*(floor(r/p)+1)
np1 = n+1
R = range(r,np1)
f(x) = (factorial(x-1)/(factorial(r-1)*factorial(x-r)))*(1-p)^(x-r)*p^r
acc = 0
for k in R:
prob = f(x=k)
acc = acc+prob
pretty_print('f(%s) = '%k,' %.8f'%prob,' and F(%s) = '%k,' %.8f'%acc)
Theorem 7.4.4 Statistics for Negative Binomial Distribution
For the Negative Binomial Distribution,xxxxxxxxxx
# Negative Binomial
var('x,n,p,r,alpha')
assume(x,'integer')
assume(alpha,'integer')
assume(alpha > 2)
assume(0 < p < 1)
def _(r=[2,5,10,15,alpha]):
f(x) = binomial(x-1,r-1)*p^r*(1-p)^(x-r)
mu = sum(x*f,x,r,oo).full_simplify()
M2 = sum(x^2*f,x,r,oo).full_simplify()
M3 = sum(x^3*f,x,r,oo).full_simplify()
M4 = sum(x^4*f,x,r,oo).full_simplify()
pretty_print('Mean = ',mu)
v = (M2-mu^2).full_simplify()
pretty_print('Variance = ',v)
stand = sqrt(v)
sk = (((M3 - 3*M2*mu + 2*mu^3)).full_simplify()/stand^3).factor()
pretty_print('Skewness = ',sk)
kurt = ((M4 - 4*M3*mu + 6*M2*mu^2 -3*mu^4)/v^2).full_simplify()
pretty_print('Kurtosis = ',(kurt-3).factor(),'+3')