I wish to model the number of bugs caused by software development. This is intuitively sort of a Poisson process, however it is overdispersed. One thing we can do in this case is to use a negative binomial distribution (because negative binomial approaches Poisson as r
gets larger, or because we might think the parameter $\lambda$ of the poisson is itself gamma-distributed.)
I'm not sure how to do this though. For example, we have that $$\lim_{r\to\infty}NB\left(r,\frac{\lambda}{\lambda+r}\right)=\text{Poisson}(\lambda)$$ Given that a poisson process of duration $t$ can be modeled as $\text{Poisson}(\lambda t)$ I guess we could look at $NB\left(r,\frac{\lambda t}{\lambda t+r}\right)$ - is that correct? Given that I know $t$, it seems like I should be setting $r=t$.
At a more technical level, glm.nb
from the MASS
package seems to fit $r$ not the dispersion parameter and I don't see an obvious parameter to change this.
Any insight at the theoretical or technical level would be appreciated.