`logLik`

is most commonly used for a model fitted by maximum
likelihood, and some uses, e.g.by `AIC`

, assume
this. So care is needed where other fit criteria have been used, for
example REML (the default for `"lme"`

).

For a `"glm"`

fit the `family`

does not have to
specify how to calculate the log-likelihood, so this is based on using
the family's `aic()`

function to compute the AIC. For the
`gaussian`

, `Gamma`

and
`inverse.gaussian`

families it assumed that the dispersion
of the GLM is estimated and has been counted as a parameter in the AIC
value, and for all other families it is assumed that the dispersion is
known. Note that this procedure does not give the maximized
likelihood for `"glm"`

fits from the Gamma and inverse gaussian
families, as the estimate of dispersion used is not the MLE.

For `"lm"`

fits it is assumed that the scale has been estimated
(by maximum likelihood or REML), and all the constants in the
log-likelihood are included. That method is only applicable to
single-response fits.