Given the method-of-moments approach to estimate the parameters of the NB-2 distribution $\mu$ and $\phi$: $$ \mu = \bar{y} $$ $$ \phi = \frac{\bar{y}^2}{s^2 -\bar{y}} $$

How can this be extended to include an offset/rate parameter (i.e., where $\log(\mu) = X'\beta + \log(t)$)?

  • $\begingroup$ What is $t$? It looks like you might want to fit a negative binomial regression, Hilbe's eponymous textbook is the go-to resource. If I understand your problem correctly, it would be a question of log-transforming $t$ and then constraining the parameter to be $1$. $\endgroup$ May 3 '21 at 9:00
  • $\begingroup$ $t$ is the offset/exposure variable, for when the outcome y is the number of occurrences per unit $t$. More information in this post. The estimators in my post are equivalent to an intercept-only negative-binomial regression, but I'm trying to extend this to an intercept-and-offset model $\endgroup$
    – AndrewrJ
    May 3 '21 at 9:17
  • $\begingroup$ Thanks. That link says pretty much the same thing as my comment: feed the exposure into your model (log transform it since you are using a log link), then fix the parameter to be $1$. Is that what you are looking for? $\endgroup$ May 3 '21 at 9:19
  • $\begingroup$ Not quite. I know that it can be fit in a regression model, but I'm trying to adapt the method of moments approach so I can estimate the distribution parameters without needing maximum-likelihood/optimisation $\endgroup$
    – AndrewrJ
    May 3 '21 at 9:31
  • 1
    $\begingroup$ OK, thanks, that helps. When you write in your comment that you have an intercept-only model, that is $\log\mu=\beta_0+\log t$, it looks like you are trying to solve two equations (for the observed mean $\bar{y}$ and the observed variance $s^2$) using a single unknown $\beta_0$ plus an overdispersion parameter. So you can simply solve the equation for the mean to give you $\hat{\beta}_0$, then set the overdispersion parameter to whatever you observe. Would that work? $\endgroup$ May 3 '21 at 9:39

Your model is $\log\mu=\beta_0+\log t$, since for an offset (which you log-transform since you are working with a log link) you constrain the corresponding parameter to be $1$. On the original scale (where we want to match moments), this means for the $i$-th observation

$$ \mu_i = t_i\cdot\exp\beta_0.$$

Since you want to match moments, you can estimate $\beta_0$ so that $\hat\mu$ matches the mean of the observations, or equivalently by taking averages,

$$ \bar y = \bar t\cdot\exp\beta_0,$$

so you set

$$ \hat\beta_0 = \log\big(\frac{\bar y}{\bar t}\big)=\log\bar y-\log\bar t. $$

Now, for a negative binomial model, you have overdispersion, or

$$ E(y_i-\mu_i)^2 =\mu_i+\frac{\mu_i^2}{\phi} $$

for some overdispersion parameter $\phi>0$, which is just a reformulation of your second formula, or

$$ \phi = \frac{\mu_i^2}{E(y_i-\mu_i)^2-\mu_i}. $$

A possible moments estimator would then be

$$ \hat\phi = \frac{\sum_{i=1}^n\hat\mu_i^2}{\sum_{i=1}^n(y_i-\hat\mu_i)^2-\hat\mu_i}. $$

There is likely some bias involved here, so I would recommend you think about "real" maximum likelihood estimation. Hilbe's textbook Negative Binomial Regression is very helpful.

  • $\begingroup$ Excellent! Thanks so much for the quick help! $\endgroup$
    – AndrewrJ
    May 3 '21 at 11:51
  • $\begingroup$ Sorry, quick follow-up. Where you wrote for overdispersion: $E(y_i - \mu_i)^2 = \mu_i(1+\frac{1}{\phi})$, shouldn't the variance be defined as: $\mu_i(1+\frac{\mu_i}{\phi})$? Or are you referring to a different quantity? $\endgroup$
    – AndrewrJ
    May 4 '21 at 6:45
  • 1
    $\begingroup$ Yes, you are right, I'm sorry, my bad, I got confused. There are too many different parameterizations of the negbin... I edited my answer. $\endgroup$ May 4 '21 at 15:29
  • $\begingroup$ No worries at all, your help is very much appreciated $\endgroup$
    – AndrewrJ
    May 4 '21 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.