I am working with a negative binomial model in R using the MASS library. I am trying to estimate the predicted count for one of my explanatory variables. Does anyone happen to know the command for the inverse link? For instance, in R, regarding the probit model, the inverse link is pnorm (coefficients). What is it for the negative binomial in R? I have been looking online with little success. Any help would be greatly appreciated.
1 Answer
The standard link in most negative binomial regression models is the log link $\log(\mu) = x_i^\top \beta$. Thus, the inverse is simply $\exp(x_i^\top \beta) = \mu$.
This is also the standard link in glm.nb()
in R - as well as in other R packages implementing the model. By the way, in glm
and negbin
objects you can access the inverse link function by object$family$linkinv
. So you can always take this from the fitted model object.
Previous versions of this response erroneously claimed that this is not only the "standard" link but also the "canonical" link. However, this is only the case for the Poisson distribution (a special case of the negative binomial for $\theta \rightarrow \infty$). For discussions of the canonical link, see: Negative binomial regression question - is it a poor model? An R implementation is available in the VGAM
package, see https://www.rdocumentation.org/packages/VGAM/versions/1.0-6/topics/nbcanlink
-
$\begingroup$ Thank you. I always thought exp was for the Poisson model and didn't realize it was NB. Thanks! $\endgroup$– DyllanCommented Nov 15, 2018 at 6:39
-
$\begingroup$ It is the canonical link in both models (and hence used by default in R). $\endgroup$ Commented Nov 15, 2018 at 6:43
-
$\begingroup$ @Achim log is definitely the default in R but are you sure it's canonical for the negative binomial? $\endgroup$– Glen_bCommented Nov 15, 2018 at 11:30
-
$\begingroup$ @Glen_b You are too kind! Lesson learned: Don't answer SE questions before having a shower. I'll correct... $\endgroup$ Commented Nov 15, 2018 at 21:11