= Solution
Use <negative binomial regression> with a logarithmic mean link, for example
``
library(MASS)
species_nb <- glm.nb(nspecies ~ altitude, link = log)
``
In the mean-size parametrization,
$$
\mathbb E Y_i=\mu_i=e^{\beta_0+\beta_aa_i},\qquad
\operatorname{Var}(Y_i)=\mu_i+\frac{\mu_i^2}{\theta},\qquad\theta>0.
$$
The extra parameter allows <overdispersion> that grows quadratically with the mean, unlike the proportional variance of <Quasi-Poisson regression>.
\b[The printed assertion needs qualification: a negative-binomial model with fixed size is a generalized linear model.] For known $\theta$, its probability mass function is
$$
p(y;\mu,\theta)=\frac{\Gamma(y+\theta)}{\Gamma(\theta)y!}
\left(\frac{\theta}{\theta+\mu}\right)^\theta
\left(\frac{\mu}{\theta+\mu}\right)^y.
$$
With natural parameter $\eta_c=\log[\mu/(\theta+\mu)]<0$, it has <exponential family> form
$$
\log p(y)=y\eta_c-b_\theta(\eta_c)+c_\theta(y),\qquad
b_\theta(\eta_c)=-\theta\log(1-e^{\eta_c}),
$$
with dispersion one. A logarithmic link is permitted even though it is not the <canonical link function>. This is the <fixed-size negative binomial generalized linear model>.
What prevents a single ordinary fixed-family GLM fit in `glm.nb` is joint estimation of the unknown size $\theta$: it changes the cumulant, carrier, and <variance function>, rather than merely multiplying a fixed variance function by a scalar dispersion. The routine alternates a GLM fit at fixed $\theta$ with size-parameter likelihood updates. Thus the intended distinction is between that enlarged fitting problem and a single fixed-family GLM, not a claim that negative-binomial regression can never be a GLM. The package documentation explicitly supports both conventions: https://stat.ethz.ch/R-manual/R-patched/library/MASS/html/glm.nb.html and https://stat.ethz.ch/R-manual/R-patched/library/MASS/html/negative.binomial.html.
Back to article page