Class of objects returned by fitting double generalized linear models.

Write *m_i = E(y_i)* for the expectation of the
*i*th response.
Then *Var(y_i) = s_iV(m_i)* where *V*
is the variance function and *s_i* is the dispersion of the
*i*th response
(often denoted as the Greek character ‘phi’).
We assume the link linear models
*g(m_i) = x_i^T b* and
*h(s_i) = z_i^T a*,
where *x_i* and *z_i* are vectors of covariates,
and *b* and *a* are vectors of regression
cofficients affecting the mean and dispersion respectively.
The argument `dlink`

specifies *h*.
See `family`

for how to specify *g*.
The optional arguments `mustart`

, `betastart`

and `phistart`

specify starting values for *m_i*, *b*
and *s_i* respectively.

The parameters *b* are estimated as for an ordinary glm.
The parameters *a* are estimated by way of a dual glm
in which the deviance components of the ordinary glm appear as responses.
The estimation procedure alternates between one iteration for the mean submodel
and one iteration for the dispersion submodel until overall convergence.

The output from `dglm`

, `out`

say, consists of two `glm`

objects
(that for the dispersion submodel is `out$dispersion.fit`

) with a few more
components for the outer iteration and overall likelihood.
The `summary`

and `anova`

functions have special methods for `dglm`

objects.
Any generic function which has methods for `glm`

s or `lm`

s will work on
`out`

, giving information about the mean submodel.
Information about the dispersion submodel can be obtained by using
`out$dispersion.fit`

as argument rather than out itself.
In particular `drop1(out,scale=1)`

gives correct score statistics for
removing terms from the mean submodel,
while `drop1(out$dispersion.fit,scale=2)`

gives correct score
statistics for removing terms from the dispersion submodel.

The dispersion submodel is treated as a gamma family unless the original
reponses are gamma, in which case the dispersion submodel is digamma.
(Note that the digamma and trigamma functions are required to fit a digamma
family.) This is exact if the original glm family is `gaussian`

,
`Gamma`

or `inverse.gaussian`

. In other cases it can be
justified by the saddle-point approximation to the density of the responses.
The results will therefore be close to exact ML or REML when the dispersions
are small compared to the means. In all cases the dispersion submodel as prior
weights 1, and has its own dispersion parameter which is 2.

This class of objects is returned by the `dglm`

function
to represent a fitted double generalized linear model.
Class `"dglm"`

inherits from class `"glm"`

,
since it consists of two coupled generalized linear models,
one for the mean and one for the dispersion.
Like `glm`

,
it also inherits from `lm`

.
The object returned has all the components of a `glm`

object.
The returned component `object$dispersion.fit`

is also a
`glm`

object in its own right,
representing the result of modelling the dispersion.

Objects of this class have methods for the functions
`print`

, `plot`

, `summary`

, `anova`

, `predict`

,
`fitted`

, `drop1`

, `add1`

, and `step`

, amongst others.
Specific methods (not shared with `glm`

) exist for
`summary`

and `anova`

.

A `dglm`

object consists of a `glm`

object with the following
additional components:

dispersion.fitthe dispersion submodel: a

`glm`

object representing the fitted model for the dispersions. The responses for this model are the deviance components from the original generalized linear model. The prior weights are 1 and the dispersion or scale of this model is 2.iterthis component now represents the number of outer iterations used to fit the coupled mean-dispersion models. At each outer iteration, one IRLS is done for each of the mean and dispersion submodels.

methodfitting method used:

`"ml"`

if maximum likelihood was used or`"reml"`

if adjusted profile likelihood was used.m2loglikminus twice the log-likelihood or adjusted profile likelihood of the fitted model.

The anova method is questionable when applied to an `dglm`

object with
`method="reml"`

(stick to `method="ml"`

).

Gordon Smyth,
ported to **R**\ by Peter Dunn (pdunn2@usc.edu.au)

Smyth, G. K. (1989). Generalized linear models with varying dispersion.
*J. R. Statist. Soc. B*, **51**, 47–60.

Smyth, G. K., and Verbyla, A. P. (1999).
Adjusted likelihood methods for modelling dispersion in generalized linear models.
*Environmetrics*, **10**, 696-709.

Verbyla, A. P., and Smyth, G. K. (1998). Double generalized linear models: approximate residual maximum likelihood and diagnostics. Research Report, Department of Statistics, University of Adelaide.

`dglm.object`

, `Digamma family`

, `Polygamma`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
# Continuing the example from glm, but this time try
# fitting a Gamma double generalized linear model also.
clotting <- data.frame(
u = c(5,10,15,20,30,40,60,80,100),
lot1 = c(118,58,42,35,27,25,21,19,18),
lot2 = c(69,35,26,21,18,16,13,12,12))
# The same example as in glm: the dispersion is modelled as constant
out <- dglm(lot1 ~ log(u), ~1, data=clotting, family=Gamma)
summary(out)
# Try a double glm
out2 <- dglm(lot1 ~ log(u), ~u, data=clotting, family=Gamma)
summary(out2)
anova(out2)
# Summarize the mean model as for a glm
summary.glm(out2)
# Summarize the dispersion model as for a glm
summary(out2$dispersion.fit)
# Examine goodness of fit of dispersion model by plotting residuals
plot(fitted(out2$dispersion.fit),residuals(out2$dispersion.fit))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.