# Estimate dispersion parameters in negative binomial distribution

A popular parameterization of the negative binomial distribution is by $$\mu$$ and $$r$$, which represent mean and dispersion, respectively. The probability mass function states: $$\text{P(x = k)} = \frac{\Gamma(r + k)}{k! \Gamma(r)} \cdot \Bigg( \frac{r}{r + \mu} \Bigg)^r \Bigg( \frac{\mu}{r + \mu} \Bigg)^k$$

A common way to infer population parameter $$r, \mu$$ from samples is to use maximum likelihood estimation.

There is a relationship between $$\mu, \sigma^2, r$$, which is $$r = \frac{\mu^2}{\sigma^2 - \mu}$$

I was wondering if this would be a reasonable way to infer population parameters:

1. calculate sample mean $$\bar x$$ and sample variance $$s^2$$
2. infer the population dispersion as $$\hat r = \frac{\bar x^2}{s^2 - \bar x}$$

Having said this, though, it can easily be, especially with small samples and not much overdispersion, that $$s^2 \leq \bar{x}$$, in which case you have a problem. In this case, the MLE doesn't exist either. Other estimators can be found in Estimating the Negative Binomial Dispersion Parameter.