3

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)$)?

AndrewrJ
  • 53
  • 4
  • 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$. – Stephan Kolassa May 03 '21 at 09:00
  • $t$ is the offset/exposure variable, for when the outcome y is the number of occurrences per unit $t$. More information in [this post](https://stats.stackexchange.com/a/66878/299942). 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 – AndrewrJ May 03 '21 at 09:17
  • 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? – Stephan Kolassa May 03 '21 at 09:19
  • 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 – AndrewrJ May 03 '21 at 09:31
  • 1
    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? – Stephan Kolassa May 03 '21 at 09:39
  • That should work for $\mu$, but what do you mean by "set the overdispersion parameter to whatever you observe" sorry? – AndrewrJ May 03 '21 at 09:46

1 Answers1

4

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.

Stephan Kolassa
  • 95,027
  • 13
  • 197
  • 357
  • Excellent! Thanks so much for the quick help! – AndrewrJ May 03 '21 at 11:51
  • 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? – AndrewrJ May 04 '21 at 06:45
  • 1
    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. – Stephan Kolassa May 04 '21 at 15:29
  • No worries at all, your help is very much appreciated – AndrewrJ May 04 '21 at 23:27