3
$\begingroup$

I know that for a univariate linear regression the predictions are generated like: $$\hat{y} = \beta_0 + \beta_1 x $$

And for a univariate logistic regression the predictions are generated like:

$$\hat{y} = \dfrac{1}{1+e^{-(\beta_0 + \beta_1 x)}}$$

So my question is, what is the equation for a univariate negative binomial regression, specifically one fitted by R's nb.glm function? My guess is that it's something like:

$$\hat{y} = \binom{k+\theta-1}{k} \bigg(\frac{1}{1+e^{-(\beta_0 + \beta_1 x)}}\bigg)^k\bigg(1-\frac{1}{1+e^{-(\beta_0 + \beta_1 x)}}\bigg)^\theta$$

But then I don't know how to make sense of the parameters $k$ and $\theta$

I feel I've reached the limits of my google-fu, so any help would be much appreciated.

$\endgroup$
  • 1
    $\begingroup$ Lol at Google-fu. As far as I can tell, it's the same as Poisson, so $e^{\beta_0+\beta_1 x}$. $\endgroup$ – Heteroskedastic Jim Jul 26 '18 at 1:46
  • 1
    $\begingroup$ The fitted function usually predicts on the response scale. So a simple way to verify this would be to check if exp(X %*% coefs) equals fitted(model), where model is fitted using glm.nb, X is your model matrix and coefs are your regression coefficients. $\endgroup$ – Heteroskedastic Jim Jul 26 '18 at 1:52
  • 4
    $\begingroup$ @jon You're specifying the conditional distribution as negative binomial, but the exact functional form depends on the link function, which is set by the "link" argument, it's not inherent in the fact that it's negative binomial. This is distinct from logistic regression (the logistic is the link function being used, the conditional distribution is binomial and other links may be used with that). The default link for the function you call (i.e. the one that's used if you don't specify a link) is the log link as can be seen by reading the help on the function. $\endgroup$ – Glen_b -Reinstate Monica Jul 26 '18 at 2:16
  • 1
    $\begingroup$ You might be interested in Negative Binomial Regression by Hilbe. $\endgroup$ – Stephan Kolassa Jul 26 '18 at 8:00
  • $\begingroup$ @Stephan It didn't seem like a full answer to me when I started to write it, though I guess it got closer after I edited it. I suppose I can post it but it still seems a little thin. $\endgroup$ – Glen_b -Reinstate Monica Jul 26 '18 at 12:48
4
$\begingroup$

You're specifying the conditional distribution as negative binomial, but the exact functional form depends on the link function, it's not inherent in the fact that it's negative binomial.

This is distinct from logistic regression where the logistic is the link function being used, the conditional distribution is binomial and other links may be used with a binomial (i.e. logistic regression is really a binomial GLM with a logit link).

The default link for the function you call - the one that's used if you don't specify a link, and a common choice - is the log link (as can be seen from the help on the function).

$\endgroup$
  • 2
    $\begingroup$ +1. Embrace the Twitter answer! $\endgroup$ – Stephan Kolassa Jul 26 '18 at 13:43
  • $\begingroup$ This answer led me down a very fruitful path of understanding how in the case of negative binomial regression the link function is particularly contentious, because it's one of the only commonly-used regressions where the "canonical link" is not the one that is most often used. I found this to be an especially helpful resource: dept.stat.lsa.umich.edu/~kshedden/Courses/Stat600/Notes/glm.pdf $\endgroup$ – jon_simon Jul 26 '18 at 20:48
  • $\begingroup$ That's correct. When writing the above I debated including a sentence to that effect (that it's not the natural link/canonical link) in the answer and even started to type it, but eventually decided that while it was interesting, it was not necessarily helpful and left it out. Now I wonder if I should put it in. On the other hand, it is discussed in other posts on site (e.g. here); perhaps a link to something like that would be better. $\endgroup$ – Glen_b -Reinstate Monica Jul 26 '18 at 23:26
  • $\begingroup$ @Glen_b Honestly, it's probably better that you left it out, I didn't even have the context to understand what that meant until I did some additional reading after posting this question $\endgroup$ – jon_simon Jul 27 '18 at 4:12

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.