The standard Poisson GLM models the (conditional) mean
\(\mathsf{E}[y] = \mu\) which is assumed to be equal to the
variance \(\mathsf{VAR}[y] = \mu\). dispersiontest
assesses the hypothesis that this assumption holds (equidispersion) against
the alternative that the variance is of the form:
$$\mathsf{VAR}[y] \quad = \quad \mu \; + \; \alpha \cdot \mathrm{trafo}(\mu).$$
Overdispersion corresponds to \(\alpha > 0\) and underdispersion to
\(\alpha < 0\). The coefficient \(\alpha\) can be estimated
by an auxiliary OLS regression and tested with the corresponding t (or z) statistic
which is asymptotically standard normal under the null hypothesis.
Common specifications of the transformation function \(\mathrm{trafo}\) are
\(\mathrm{trafo}(\mu) = \mu^2\) or \(\mathrm{trafo}(\mu) = \mu\).
The former corresponds to a negative binomial (NB) model with quadratic variance function
(called NB2 by Cameron and Trivedi, 2005), the latter to a NB model with linear variance
function (called NB1 by Cameron and Trivedi, 2005) or quasi-Poisson model with dispersion
parameter, i.e.,
$$\mathsf{VAR}[y] \quad = \quad (1 + \alpha) \cdot \mu = \mathrm{dispersion} \cdot \mu.$$
By default, for trafo = NULL, the latter dispersion formulation is used in
dispersiontest. Otherwise, if trafo is specified, the test is formulated
in terms of the parameter \(\alpha\). The transformation trafo can either
be specified as a function or an integer corresponding to the function function(x) x^trafo,
such that trafo = 1 and trafo = 2 yield the linear and quadratic formulations
respectively.