Phrase structure rules: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Anypodetos
m Remove caps
Line 1: Line 1:
{{Negative binomial distribution}}
My name's Trudi Tennyson but everybody calls me Trudi. I'm from Germany. I'm studying at the college (1st year) and I play the Saxhorn for 7 years. Usually I choose music from my famous films :D. <br>I have two sister. I like People watching, watching TV (Doctor Who) and Aircraft spotting.<br><br>my webpage :: [http://www.foodstainedhands.com/2012/03/coconut-date-bread-deliciousness.html FIFA 15 coin hack]
 
In [[probability theory]] and [[statistics]], the '''negative binomial distribution''' is a [[discrete probability distribution]] of the number of successes in a sequence of [[Bernoulli trial]]s before a specified (non-random) number of failures (denoted ''r'') occurs. For example, if we define a "1" as failure, and all non "1"s as successes, and we throw a [[dice]] repeatedly until the third time “1” appears (''r'' = three failures), then the probability distribution of the number of non-“1”s that had appeared will be negative binomial.
 
The '''Pascal distribution''' (after [[Blaise Pascal]]) and '''Polya distribution''' (for [[George Pólya]]) are special cases of the negative binomial. There is a convention among engineers, climatologists, and others to reserve “negative binomial” in a strict sense or “Pascal” for the case of an integer-valued stopping-time parameter ''r'', and use “Polya” for the real-valued case. The Polya distribution more accurately models occurrences of “contagious” discrete events, like tornado outbreaks, than the [[Poisson distribution]] by allowing the mean and variance to be different, unlike the Poisson. “Contagious” events have positively correlated occurrences causing a larger [[variance]] than if the occurrences were independent, due to a positive [[covariance]] term.
 
==Definition==
Suppose there is a sequence of independent [[Bernoulli trial]]s, each trial having two potential outcomes called “success” and “failure”. In each trial the probability of success is ''p'' and of failure is (1 − ''p''). We are observing this sequence until a predefined number ''r'' of failures has occurred. Then the random number of successes we have seen, ''X'', will have the '''negative binomial''' (or '''Pascal''') distribution:
: <math>
    X\ \sim\ \text{NB}(r; p)
  </math>
 
When applied to real-world problems, outcomes of ''success'' and ''failure'' may or may not be outcomes we ordinarily view as good and bad, respectively. Suppose we used the negative binomial distribution to model the number of days a certain machine works before it breaks down. In this case “success” would be the result on a day when the machine worked properly, whereas a breakdown would be a “failure”. If we used the negative binomial distribution to model the number of goal attempts a sportsman makes before scoring a goal, though, then each unsuccessful attempt would be a “success”, and scoring a goal would be “failure”. If we are tossing a coin, then the negative binomial distribution can give the number of heads (“success”) we are likely to encounter before we encounter a certain number of tails (“failure”). In the probability mass function below, p is the probability of success, and (1-p) is the probability of failure.
 
The [[probability mass function]] of the negative binomial distribution is
: <math>
    f(k; r, p) \equiv \Pr(X = k) = {k+r-1 \choose k} (1-p)^kp^r \quad\text{for }k = 0, 1, 2, \dots
  </math>
 
Here the quantity in parentheses is the [[binomial coefficient]], and is equal to
: <math>
    {k+r-1 \choose k} = \frac{(k+r-1)!}{k!\,(r-1)!} = \frac{(k+r-1)(k+r-2)\cdots(r)}{k!}.
  </math>
 
This quantity can alternatively be written in the following manner, explaining the name “negative binomial”:
: <math>
    \frac{(k+r-1)\cdots(r)}{k!} = (-1)^k \frac{(-r)(-r-1)(-r-2)\cdots(-r-k+1)}{k!} = (-1)^k{-r \choose k}.
    \qquad (*)
  </math>
 
To understand the above definition of the probability mass function, note that the probability for every specific sequence of ''k''&nbsp;successes and ''r''&nbsp;failures is {{nowrap|(1 − ''p'')''<sup>r</sup>p<sup>k</sup>''}}, because the outcomes of the ''k''&nbsp;+&nbsp;''r'' trials are supposed to happen [[independence (probability theory)|independently]]. Since the ''r''<sup>th</sup>&nbsp;failure comes last, it remains to choose the ''k''&nbsp;trials with successes out of the remaining ''k''&nbsp;+&nbsp;''r''&nbsp;−&nbsp;1 trials. The above binomial coefficient, due to its combinatorial interpretation, gives precisely the number of all these sequences of length ''k''&nbsp;+&nbsp;''r''&nbsp;−&nbsp;1.
 
===Expectation===
 
The expected total number of trials k+r of a negative binomial distribution with parameters (r,p) is r/(1-p). To see this intuitively, imagine the above experiment is performed a whole bunch of times. That is, a bunch of trials are performed until r failures are obtained,then another bunch of trials, and then another etc. Write down the number of trials performed in each experiment: a, b, c... and set a + b + c + ... = N. Now we would expect about N(1-p) failures in total. Say the experiment was performed n times. Then there are nr failures in total. So we would expect nr = N(1-p), so N/n = r/(1-p). See that N/n is just the average number of trials per experiment. That is what we mean by "expectation." The average number of successes per experiment is N/n - r, which must have expected value equal to r/(1-p) - r = rp/(1-p). This agrees with the Mean given in the box on the right-hand side of this page.
 
===Extension to real-valued ''r''===
It is possible to extend the definition of the negative binomial distribution to the case of a positive [[real number|real]] parameter ''r''. Although it is impossible to visualize a non-integer number of “failures”, we can still formally define the distribution through its probability mass function.
 
As before, we say that ''X'' has a '''negative binomial''' (or '''Pólya''') distribution if it has a [[probability mass function]]:
: <math>
    f(k; r, p) \equiv \Pr(X = k) = {k+r-1 \choose k} (1-p)^kp^r \quad\text{for }k = 0, 1, 2, \dots
  </math>
Here ''r'' is a real, positive number. The binomial coefficient is then defined by the [[binomial coefficient#Multiplicative formula|multiplicative formula]] and can also be rewritten using the [[gamma function]]:
: <math>
    {k+r-1 \choose k} = \frac{(k+r-1)(k+r-2)\cdots(r)}{k!} = \frac{\Gamma(k+r)}{k!\,\Gamma(r)}.
  </math>
Note that by the [[binomial series]] and (*) above, for every {{nowrap|0 ≤ ''p'' < 1}},
:<math>
(1-p)^{-r}=\sum_{k=0}^\infty{-r \choose k}(-p)^k
=\sum_{k=0}^\infty{k+r-1\choose k}p^k,
</math>
hence the terms of the probability mass function indeed add up to one.
 
===Alternative formulations===
Some textbooks may define the negative binomial distribution slightly differently than it is done here. The most common variations are:
<ul>
<li>
The definition where ''X'' is the total number of '''trials''' needed to get ''r'' failures, not simply the number of successes. Since the total number of trials is equal to the number of successes plus the number of failures, this definition differs from ours by adding constant&nbsp;''r''.
 
In order to convert formulas written with this definition into the one used in the article, replace everywhere “''k''” with {{nowrap|“''k - r''”}}, and also subtract ''r'' from the [[mean]], the [[median]], and the [[mode (statistics)|mode]]. In order to convert formulas of this article into this alternative definition, replace “''k''” with {{nowrap|“''k + r''”}} and add ''r'' to the mean, the median and the mode. Effectively, this implies using the probability mass function
: <math>
    f(k; r, p) \equiv \Pr(X = k) = {k-1 \choose k-r} (1-p)^r p^{k-r} \quad\text{for }k = r, r+1, r+2, \dots,
  </math>
which perhaps resembles the [[binomial distribution]] more closely than the version above. Note that the arguments of the [[binomial coefficient]] are decremented due to ''order'': the last "failure" must occur ''last'', and so the other events have one fewer positions available when counting possible orderings.
 
Note that this definition of the negative binomial distribution does not easily generalize to a positive, real parameter&nbsp;''r''.
 
<li> The definition where ''p'' denotes the probability of a '''failure''', not of a success.
 
In order to convert formulas between this definition and the one used in the article, replace “''p''” with {{nowrap|“1 − ''p''”}} everywhere.
 
<li> The definition where the support ''X'' is defined as the number of failures, rather than the number of successes.  This definition — where ''X'' counts failures but ''p'' is the probability of success — has exactly the same formulas as in the previous case where ''X'' counts successes but ''p'' is the probability of failure.  However, the corresponding text will have the words “failure” and “success” swapped compared with the previous case.
 
<li> The two alterations above may be applied simultaneously, i.e. ''X'' counts total trials, and ''p'' is the probability of failure.
 
<li> In negative binomial regression,<ref name="neg bin reg">Hilbe, Joseph M. (2011), "Negative Binomial Regression, second edition", Cambridge, UK: Cambridge University Press</ref> the distribution is specifed in terms of its mean, ''m'', which is then related to explanatory variables as in [[linear regression]] or other [[generalized linear models]]. The probability mass function then becomes
 
: <math>
    \Pr(X = k) = \left(\frac{r}{r+m}\right)^r \frac{\Gamma(r+k)}{k! \, \Gamma(r)} \left(\frac{m}{r+m}\right)^k \quad\text{for }k = 0, 1, 2, \dots.
  </math>
 
The variance can then be written <math>m+\frac{m^2}{r}</math>, and the parameter ''r'' is referred to as the “dispersion parameter”, “shape parameter” or “clustering coefficient”,<ref>Lloyd-Smith, J.O. (2007), "Maximum Likelihood Estimation of the Negative Binomial Dispersion Parameter for Highly Overdispersed Data, with Applications to Infectious Diseases". [[PLoS ONE]] 2(2): e180. doi:10.1371/journal.pone.0000180</ref> or the “heterogeneity”<ref name="neg bin reg" /> or “aggregation” parameter.<ref>Crawley, Michael J. (2012), "The R Book", Wiley</ref> The term “aggregation” is particularly used in ecology when describing counts of individual organisms. Decrease of the aggregation parameter ''r'' towards zero corresponds to increasing aggregation of the organisms; increase of ''r'' towards infinity corresponds to absence of aggregation, as can be described by [[Poisson regression]]. Some implementations of negative binomial regression use the reciprocal of ''r'' and refer to that also as the “dispersion parameter”.
</ul>
 
==Occurrence==
 
===Waiting time in a Bernoulli process===
 
For the special case where ''r'' is an integer, the negative binomial distribution is known as the '''Pascal distribution'''. It is the probability distribution of a certain number of failures and successes in a series of [[Independent identically-distributed random variables|independent and identically distributed]] Bernoulli trials. For ''k''&nbsp;+&nbsp;''r'' [[Bernoulli trial]]s with success probability ''p'', the negative binomial gives the probability of ''k'' successes and ''r'' failures, with a failure on the last trial. In other words, the negative binomial distribution is the probability distribution of the number of successes before the ''r''th failure in a [[Bernoulli process]], with probability ''p'' of successes on each trial. A Bernoulli process is a [[discrete random variable|discrete]] time process, and so the number of trials, failures, and successes are integers.
 
Consider the following example. Suppose we repeatedly throw a die, and consider a “1” to be a “failure”.  The probability of failure on each trial is 1/6. The number of successes before the third failure belongs to the infinite set {&thinsp;0,&nbsp;1,&nbsp;2,&nbsp;3,&nbsp;...&thinsp;}. That number of successes is a negative-binomially distributed random variable.
 
When ''r'' = 1 we get the probability distribution of number of successes before the first failure (i.e. the probability of the first failure occurring on the (''k''&nbsp;+&nbsp;1)<sup>st</sup> trial), which is a [[geometric distribution]]:
: <math>
    f(k; r, p) = (1-p) \cdot p^k \!
  </math>
 
===Overdispersed Poisson===
 
The negative binomial distribution, especially in its alternative parameterization described above, can be used as an alternative to the Poisson distribution.  It is especially useful for discrete data over an unbounded positive range whose sample [[variance]] exceeds the sample [[mean]]. In such cases, the observations are [[Overdispersion|overdispersed]] with respect to a Poisson distribution, for which the mean is equal to the variance. Hence a Poisson distribution is not an appropriate model.  Since the negative binomial distribution has one more parameter than the Poisson, the second parameter can be used to adjust the variance independently of the mean. See [[Cumulant#Cumulants of some discrete probability distributions|Cumulants of some discrete probability distributions]].  An application of this is to annual counts of [[tropical cyclone]]s in the [[Atlantic Ocean|North Atlantic]] or to monthly to 6-monthly counts of wintertime [[extratropical cyclone]]s over Europe, for which the variance is greater than the mean.<ref>{{cite journal|last=Villarini |first=G. |coauthors=Vecchi, G.A. and Smith, J.A.|year=2010 |month= |title=Modeling of the dependence of tropical storm counts in the North Atlantic Basin on climate indices |journal=[[Monthly Weather Review]] |volume=138 |issue=7 |pages=2681–2705 |doi=10.1175/2010MWR3315.1  |url= |accessdate= |pmid=}}</ref><ref>{{cite journal|last=Mailier |first=P.J. |coauthors=Stephenson, D.B.; Ferro, C.A.T.; Hodges, K.I.|year=2006 |month= |title=Serial Clustering of Extratropical Cyclones |journal=[[Monthly Weather Review]] |volume=134 |issue=8 |pages=2224–2240 |doi=10.1175/MWR3160.1 |url= |accessdate= |pmid=}}</ref><ref>{{cite journal|last=Vitolo |first=R. |coauthors=Stephenson, D.B.; Cook, Ian M.; Mitchell-Wallace, K.|year=2009 |month= |title=Serial clustering of intense European storms |journal=[[Meteorologische Zeitschrift]] |volume=18 |issue=4 |pages=411–424 |doi=10.1127/0941-2948/2009/0393 |url= |accessdate= |pmid=}}</ref>  In the case of modest overdispersion, this may produce substantially similar results to an overdispersed Poisson distribution.<ref>{{cite book  | last = McCullagh | first = Peter | authorlink= Peter McCullagh | coauthors = [[John Nelder|Nelder, John]] | title = Generalized Linear Models, Second Edition | publisher = Boca Raton: Chapman and Hall/CRC | year = 1989 | isbn = 0-412-31760-5 |ref=McCullagh1989}}</ref><ref>{{cite book  | last = Cameron | first = Adrian C. | coauthors = Trivedi, Pravin K. | title = Regression analysis of count data | publisher = Cambridge University Press| year = 1998 | isbn = 0-521-63567-5 |ref=Cameron1998}}</ref>
 
==Related distributions==
*The [[geometric distribution]] (on {&nbsp;0,&nbsp;1,&nbsp;2,&nbsp;3,&nbsp;...&nbsp;}) is a special case of the negative binomial distribution, with
::<math>\text{Geom}(p) = \text{NB}(1,\, 1-p).\,</math>
 
*The negative binomial distribution is a special case of the [[discrete phase-type distribution]].
 
*The negative binomial distribution is a special case of the stuttering Poisson distribution.<ref>{{Cite journal |first =Zhang  | last = Huiming | coauthors = [[Lili Chu]], [[Yu Diao]]|title=Some Properties of the Generalized Stuttering Poisson Distribution and its Applications |journal=[[Studies in Mathematical Sciences]] |volume=5 |issue=1 |year=2012|pages=11–26 |doi=10.3968/j.sms.1923845220120501.Z0697 }}</ref>
 
===Poisson distribution===
Consider a sequence of negative binomial distributions where the stopping parameter ''r'' goes to infinity, whereas the probability of success in each trial, ''p'', goes to zero in such a way as to keep the mean of the distribution constant. Denoting this mean ''λ'', the parameter ''p'' will have to be
: <math>
    \lambda = r\,\frac{p}{1-p} \quad \Rightarrow \quad p = \frac{\lambda}{r+\lambda}.
  </math>
 
Under this parametrization the probability mass function will be
: <math>
    f(k; r, p) = \frac{\Gamma(k+r)}{k!\cdot\Gamma(r)}(1-p)^kp^r = \frac{\lambda^k}{k!} \cdot \frac{\Gamma(r+k)}{\Gamma(r)\;(r+\lambda)^k} \cdot \frac{1}{\left(1+\frac{\lambda}{r}\right)^{r}}
  </math>
 
Now if we consider the limit as ''r'' → ∞, the second factor will converge to one, and the third to the exponent function:
: <math>
    \lim_{r\to\infty} f(k; r, p) = \frac{\lambda^k}{k!} \cdot 1 \cdot \frac{1}{e^\lambda},
  </math>
which is the mass function of a [[Poisson distribution|Poisson-distributed]] random variable with expected value&nbsp;''λ''.
 
In other words, the alternatively parameterized negative binomial distribution [[convergence in distribution|converges]] to the Poisson distribution and ''r'' controls the deviation from the Poisson.  This makes the negative binomial distribution suitable as a robust alternative to the Poisson, which approaches the Poisson for large ''r'', but which has larger variance than the Poisson for small ''r''.
: <math>
    \text{Poisson}(\lambda) = \lim_{r \to \infty} \text{NB}\Big(r,\ \frac{\lambda}{\lambda+r}\Big).
  </math>
 
===Gamma–Poisson mixture===
The negative binomial distribution also arises as a continuous mixture of [[Poisson distribution]]s (i.e. a [[compound probability distribution]]) where the mixing distribution of the Poisson rate is a [[gamma distribution]]. That is, we can view the negative binomial as a {{nowrap|Poisson(''λ'')}} distribution, where ''λ'' is itself a random variable, distributed as a gamma distribution with shape = ''r'' and scale  θ = {{nowrap|''p''/(1 − ''p'')}} or correspondingly rate β = {{nowrap|(1 - ''p'')/''p''}}.
 
Formally, this means that the mass function of the negative binomial distribution can be written as
 
: <math>\begin{align}
    f(k; r, p) & = \int_0^\infty f_{\text{Poisson}(\lambda)}(k) \cdot f_{\text{Gamma}\left(r,\, \frac{p}{1-p}\right)}(\lambda) \; \mathrm{d}\lambda \\[8pt]
        & = \int_0^\infty \frac{\lambda^k}{k!} e^{-\lambda} \cdot \lambda^{r-1}\frac{e^{-\lambda (1-p)/p}}{\big(\frac{p}{1-p}\big)^r\,\Gamma(r)} \; \mathrm{d}\lambda \\[8pt]
        & = \frac{(1-p)^r p^{-r}}{k!\,\Gamma(r)} \int_0^\infty \lambda^{r+k-1} e^{-\lambda/p} \;\mathrm{d}\lambda \\[8pt]
        & = \frac{(1-p)^r p^{-r}}{k!\,\Gamma(r)} \  p^{r+k} \, \Gamma(r+k) \\[8pt]
        & = \frac{\Gamma(r+k)}{k!\;\Gamma(r)} \; p^k (1-p)^r.
\end{align}</math>
 
Because of this, the negative binomial distribution is also known as the '''gamma–Poisson (mixture) distribution'''.
 
===Sum of geometric distributions===
 
If ''Y''<sub>''r''</sub> is a random variable following the negative binomial distribution with parameters ''r'' and ''p'', and support {0,&nbsp;1,&nbsp;2,&nbsp;...}, then ''Y''<sub>''r''</sub> is a sum of ''r'' [[statistical independence|independent]] variables following the [[geometric distribution]] (on {0,&nbsp;1,&nbsp;2,&nbsp;...}) with parameter ''1-p''. As a result of the [[central limit theorem]], ''Y''<sub>''r''</sub> (properly scaled and shifted) is therefore approximately [[normal distribution|normal]] for sufficiently large&nbsp;''r''.
 
Furthermore, if ''B''<sub>''s''+''r''</sub> is a random variable following the [[binomial distribution]] with parameters ''s''&nbsp;+&nbsp;''r'' and&nbsp;1&nbsp;&minus;&nbsp;''p'', then
 
: <math>
\begin{align}
\Pr(Y_r \leq s) & {} = 1 - I_p(s+1, r) \\
& {} = 1 - I_{p}((s+r)-(r-1), (r-1)+1) \\
& {} = 1 - \Pr(B_{s+r} \leq r-1) \\
& {} = \Pr(B_{s+r} \geq r) \\
& {} = \Pr(\text{after } s+r \text{ trials, there are at least } r \text{ successes}).
\end{align}
</math>
 
In this sense, the negative binomial distribution is the "inverse" of the binomial distribution.
 
The sum of independent negative-binomially distributed random variables ''r''<sub>1</sub> and ''r''<sub>2</sub> with the same value for parameter ''p'' is negative-binomially distributed with the same ''p'' but with "''r''-value"&nbsp;''r''<sub>1</sub>&nbsp;+&nbsp;''r''<sub>2</sub>.
 
The negative binomial distribution is [[Infinite divisibility (probability)|infinitely divisible]], i.e., if ''Y'' has a negative binomial distribution, then for any positive integer ''n'', there exist independent identically distributed random variables ''Y''<sub>1</sub>,&nbsp;...,&nbsp;''Y''<sub>''n''</sub> whose sum has the same distribution that ''Y'' has.
 
===Representation as compound Poisson distribution===
The negative binomial distribution NB(''r'',''p'') can be represented as a [[compound Poisson distribution]]: Let {{nowrap|{''Y<sub>n</sub>'', ''n'' ∈ ℕ<sub>0</sub>}}} denote a sequence of [[independent and identically distributed random variables]], each one having the [[logarithmic distribution]] Log(''p''), with probability mass function
 
: <math> f(k; r, p) =  \frac{-p^k}{k\ln(1-p)},\qquad k\in{\mathbb N}.</math>
 
Let ''N'' be a random variable, [[independence (probability theory)|independent]] of the sequence, and suppose that ''N'' has a [[Poisson distribution]] with mean {{nowrap|λ {{=}} −''r'' ln(1 − ''p'')}}. Then the random sum
 
: <math>X=\sum_{n=1}^N Y_n</math>
 
is NB(''r'',''p'')-distributed. To prove this, we calculate the [[probability generating function]] ''G<sub>X</sub>'' of ''X'', which is the composition of the probability generating functions ''G<sub>N</sub>'' and ''G''<sub>''Y''<sub>1</sub></sub>. Using
 
:<math>G_N(z)=\exp(\lambda(z-1)),\qquad z\in\mathbb{R},</math>
 
and
 
: <math>G_{Y_1}(z)=\frac{\ln(1-pz)}{\ln(1-p)},\qquad |z|<\frac1p,</math>
 
we obtain
 
: <math>\begin{align}G_X(z)
&=G_N(G_{Y_1}(z))\\
&=\exp\biggl(\lambda\biggl(\frac{\ln(1-pz)}{\ln(1-p)}-1\biggr)\biggr)\\
&=\exp\bigl(-r(\ln(1-pz)-\ln(1-p))\bigr)\\
&=\biggl(\frac{1-p}{1-pz}\biggr)^r,\qquad |z|<\frac1p,\end{align}</math>
 
which is the probability generating function of the NB(''r'',''p'') distribution.
 
==Properties==
 
===Cumulative distribution function===
 
The [[cumulative distribution function]] can be expressed in terms of the [[regularized incomplete beta function]]:
: <math>
    f(k; r, p) \equiv \Pr(X\le k) = 1 - I_{p}(k+1, r). \!
  </math>
 
===Sampling and point estimation of ''p''===
 
Suppose ''p'' is unknown and an experiment is conducted where it is decided ahead of time that sampling will continue until ''r'' successes are found. A [[sufficient statistic]] for the experiment is ''k'', the number of failures.
 
In estimating ''p'', the [[minimum variance unbiased estimator]] is
 
: <math>\hat{p}=\frac{r-1}{r+k-1}.</math>
 
The [[maximum likelihood]] estimate of ''p'' is
 
: <math>\tilde{p}=\frac{r}{r+k},</math>
 
but this is a [[bias of an estimator|biased estimate]]. Its inverse (''r''&nbsp;+&nbsp;''k'')/''r'', is an unbiased estimate of 1/''p'', however.<ref>[[J. B. S. Haldane]], "On a Method of Estimating Frequencies", ''[[Biometrika]]'', Vol. 33, No. 3 (Nov., 1945), pp. 222–225. {{JSTOR|2332299}}</ref>
 
===Relation to the binomial theorem===
 
Suppose ''Y'' is a random variable with a [[binomial distribution]] with parameters ''n'' and ''p''.  Assume ''p'' + ''q'' = 1, with ''p'', ''q'' >=0.  Then the binomial theorem implies that
 
:<math>1=1^n=(p+q)^n=\sum_{k=0}^n {n \choose k} p^k q^{n-k}.</math>
 
Using [[Newton's binomial theorem]], this can equally be written as:
 
:<math>(p+q)^n=\sum_{k=0}^\infty {n \choose k} p^k q^{n-k},</math>
 
in which the upper bound of summation is infinite.  In this case, the [[binomial coefficient]]
 
:<math>{n \choose k}={n(n-1)(n-2)\cdots(n-k+1) \over k! }.</math>
 
is defined when ''n'' is a real number, instead of just a positive integer.  But in our case of the binomial distribution it is zero when ''k'' > ''n''.  We can then say, for example
 
:<math>(p+q)^{8.3}=\sum_{k=0}^\infty {8.3 \choose k} p^k q^{8.3 - k}.</math>
 
Now suppose ''r'' > 0 and we use a negative exponent:
 
:<math>1=p^r\cdot p^{-r}=p^r (1-q)^{-r}=p^r \sum_{k=0}^\infty {-r \choose k} (-q)^k.</math>
 
Then all of the terms are positive, and the term
 
:<math>p^r {-r \choose k} (-q)^k</math>
 
is just the probability that the number of failures before the ''r''th success is equal to ''k'', provided ''r'' is an integer.  (If ''r'' is a negative non-integer, so that the exponent is a positive non-integer, then some of the terms in the sum above are negative, so we do not have a probability distribution on the set of all nonnegative integers.)
 
Now we also allow non-integer values of ''r''.  Then we have a proper negative binomial distribution, which is a generalization of the Pascal distribution, which coincides with the Pascal distribution when ''r'' happens to be a positive integer.
 
Recall from above that
 
:The sum of independent negative-binomially distributed random variables ''r''<sub>1</sub> and ''r''<sub>2</sub> with the same value for parameter ''p'' is negative-binomially distributed with the same ''p'' but with "''r''-value"&nbsp;''r''<sub>1</sub>&nbsp;+&nbsp;''r''<sub>2</sub>.
 
This property persists when the definition is thus generalized, and affords a quick way to see that the negative binomial distribution is [[infinite divisibility|infinitely divisible]].
 
==Parameter estimation==
 
===Maximum likelihood estimation===
 
The likelihood function for ''N'' [[independent and identically-distributed random variables|iid]] observations (''k''<sub>1</sub>,&nbsp;...,&nbsp;''k''<sub>''N''</sub>) is
 
:<math>L(r,p)=\prod_{i=1}^N f(k_i;r,p)\,\!</math>
 
from which we calculate the log-likelihood function
 
:<math>\ell(r,p) = \sum_{i=1}^N \ln{(\Gamma(k_i + r))} - \sum_{i=1}^N \ln(k_i !) - N\ln{(\Gamma(r))} + Nr\ln{(1-p)} + \sum_{i=1}^N k_i \ln(p).</math>
 
To find the maximum we take the partial derivatives with respect to ''r'' and ''p'' and set them equal to zero:
 
:<math>\frac{\partial \ell(r,p)}{\partial p} = - Nr\frac{1}{1-p} + \sum_{i=1}^N k_i \frac{1}{p} = 0</math> and
 
:<math>\frac{\partial \ell(r,p)}{\partial r} = \sum_{i=1}^N \psi(k_i + r) - N\psi(r) + N\ln{(1-p)} =0</math>
 
where
 
: <math>\psi(k) = \frac{\Gamma'(k)}{\Gamma(k)} \!</math> is the [[digamma function]].
 
Solving the first equation for ''p'' gives:
 
:<math>p = \frac{ \sum_{i=1}^N k_i / N } {r + \sum_{i=1}^N k_i / N }</math>
 
Substituting this in the second equation gives:
 
:<math>\frac{\partial \ell(r,p)}{\partial r} = \sum_{i=1}^N \psi(k_i + r) - N\psi(r) + N\ln{\left(\frac{r}{r + \sum_{i=1}^N k_i / N}\right)} =0</math>
 
This equation cannot be solved for ''r'' in [[closed form]]. If a numerical solution is desired, an iterative technique such as [[Newton's method]] can be used.
 
==Examples==
 
===Selling candy===
Pat is required to sell candy bars to raise money for the 6th grade field trip.  There are thirty houses in the neighborhood, and Pat is not supposed to return home until five candy bars have been sold.  So the child goes door to door, selling candy bars. At each house, there is a 0.4 probability of selling one candy bar and a 0.6 probability of selling nothing.
 
''What's the probability of selling the last candy bar at the'' ''n''<sup>th</sup> ''house?''
 
Recall that the NegBin(''r'', ''p'') distribution describes the probability of ''k'' failures and ''r'' successes in ''k''&nbsp;+&nbsp;''r'' Bernoulli(''p'') trials with success on the last trial.  Selling five candy bars means getting five successes.  The number of trials (i.e. houses) this takes is therefore ''k''&nbsp;+&nbsp;5&nbsp;=&nbsp;''n''.  The random variable we are interested in is the number of houses, so we substitute ''k''&nbsp;=&nbsp;''n''&nbsp;&minus;&nbsp;5 into a NegBin(5,&nbsp;0.4) mass function and obtain the following mass function of the distribution of houses (for ''n''&nbsp;≥&nbsp;5):
 
:<math> f(n) = {(n-5) + 5 - 1 \choose n-5} \; 0.4^5 \; 0.6^{n-5} = {n-1 \choose n-5} \; 2^5 \; \frac{3^{n-5}}{5^n}. </math>
 
''What's the probability that Pat finishes on the tenth house?''
 
:<math> f(10) = 0.1003290624. \, </math>
 
''What's the probability that Pat finishes on or before reaching the eighth house?''
 
To finish on or before the eighth house, Pat must finish at the fifth, sixth, seventh, or eighth house. Sum those probabilities:
:<math> f(5) = 0.01024 \, </math>
:<math> f(6) = 0.03072 \, </math>
:<math> f(7) = 0.055296 \, </math>
:<math> f(8) = 0.0774144 \, </math>
:<math>\sum_{j=5}^8 f(j) = 0.17367.</math>
 
''What's the probability that Pat exhausts all 30 houses in the neighborhood?''
 
This can be expressed as the probability that Pat [[Complementary event|does not]] finish on the fifth through the thirtieth house:
:<math>1-\sum_{j=5}^{30} f(j) = 1 - I_{0.4}(5, 30-5+1) \approx 1 - 0.99849 = 0.00151. </math>
 
===Polygyny in African societies===
Data on [[polygyny]] among a wide range of traditional African societies suggest that the distribution of wives follow a range of binomial profiles. The majority of these are negative binomial indicating the degree of competition for wives. However some tend towards a Poisson Distribution and even beyond towards a true binomial, indicating a degree of conformity in the allocation of wives. Further analysis of these profiles indicates shifts along this continuum between more competitiveness or more conformity according to the age of the husband and also according to the status of particular sectors within a society. In this way, these binomial distributions provide a tool for comparison, between societies, between sectors of societies, and over time.<ref>Spencer, Paul, 1998, ''The Pastoral Continuum: the Marginalization of Tradition in East Africa'', Clarendon Press, Oxford (pp. 51-92).</ref>
 
==See also==
* [[Coupon collector's problem]]
* [[Beta negative binomial distribution]]
* [[Extended negative binomial distribution]]
* [[Negative multinomial distribution]]
* [[Binomial distribution]]
* [[Poisson distribution]]
* [[Exponential family]]
 
==References==
{{Reflist}}
 
{{ProbDistributions|discrete-infinite}}
{{Common univariate probability distributions}}
 
{{DEFAULTSORT:Negative Binomial Distribution}}
[[Category:Discrete distributions]]
[[Category:Factorial and binomial topics]]
[[Category:Exponential family distributions]]
[[Category:Infinitely divisible probability distributions]]
[[Category:Probability distributions]]

Revision as of 18:47, 22 February 2014

My name's Trudi Tennyson but everybody calls me Trudi. I'm from Germany. I'm studying at the college (1st year) and I play the Saxhorn for 7 years. Usually I choose music from my famous films :D.
I have two sister. I like People watching, watching TV (Doctor Who) and Aircraft spotting.

my webpage :: FIFA 15 coin hack