How do I differentiate between a problem of geometric distribution and that of Negative Binomial Distribution? Both include something around first success or failure. I'm confused.
Solved – Difference between geometric distribution and negative binomial distribution
discrete datadistributionsgeometric-distributionnegative-binomial-distribution
Best Answer
Negative binomial is a distribution of a number of successes $k$ before observing $r$ failures when observing independent Bernoulli trials with the probability of success $p$. It has probability mass function
$$ f(k)= \binom{r+k-1}{k} p^k(1-p)^r $$
With geometric distribution, you stop your experiment after observing first failure, i.e. it is negative binomial $r=1$,
$$ f(k) = p^k (1-p) $$
Notice that usual naming convention with geometric distribution is that it is about observeing failures $r$ until first success, where the probability of success is $q=1-p$, so the probability mass function is written as
$$ f(r) = (1-q)^r q $$
The only difference between both formulations is what you consider as a "success" and what as a "failure" (e.g. if you count heads or tails in series of coin tosses). With this formulation, $\mathcal{G}(q) = \mathcal{NB}(1, 1-q)$.
Check also the When to use Poisson vs. geometric vs. negative binomial GLMs for count data? thread, that discusses their usage in generalized linear models.