glm
returns an object of class inheriting from "glm"
which inherits from the class "lm"
. See later in this section.
If a non-standard method
is used, the object will also inherit
from the class (if any) returned by that function.
The function summary
(i.e., summary.glm
) can
be used to obtain or print a summary of the results and the function
anova
(i.e., anova.glm
)
to produce an analysis of variance table.
The generic accessor functions coefficients
,
effects
, fitted.values
and residuals
can be used to
extract various useful features of the value returned by glm
.
weights
extracts a vector of weights, one for each case in the
fit (after subsetting and na.action
).
An object of class "glm"
is a list containing at least the
following components:
coefficientsa named vector of coefficients
residualsthe working residuals, that is the residuals
in the final iteration of the IWLS fit. Since cases with zero
weights are omitted, their working residuals are NA
.
fitted.valuesthe fitted mean values, obtained by transforming
the linear predictors by the inverse of the link function.
rankthe numeric rank of the fitted linear model.
familythe family
object used.
linear.predictorsthe linear fit on link scale.
devianceup to a constant, minus twice the maximized
log-likelihood. Where sensible, the constant is chosen so that a
saturated model has deviance zero.
aicA version of Akaike's An Information Criterion,
minus twice the maximized log-likelihood plus twice the number of
parameters, computed via the aic
component of the family.
For binomial and Poison families the dispersion is
fixed at one and the number of parameters is the number of
coefficients. For gaussian, Gamma and inverse gaussian families the
dispersion is estimated from the residual deviance, and the number
of parameters is the number of coefficients plus one. For a
gaussian family the MLE of the dispersion is used so this is a valid
value of AIC, but for Gamma and inverse gaussian families it is not.
For families fitted by quasi-likelihood the value is NA
.
null.devianceThe deviance for the null model, comparable with
deviance
. The null model will include the offset, and an
intercept if there is one in the model. Note that this will be
incorrect if the link function depends on the data other than
through the fitted mean: specify a zero offset to force a correct
calculation.
iterthe number of iterations of IWLS used.
weightsthe working weights, that is the weights
in the final iteration of the IWLS fit.
prior.weightsthe weights initially supplied, a vector of
1
s if none were.
df.residualthe residual degrees of freedom.
df.nullthe residual degrees of freedom for the null model.
yif requested (the default) the y
vector
used. (It is a vector even for a binomial model.)
xif requested, the model matrix.
modelif requested (the default), the model frame.
convergedlogical. Was the IWLS algorithm judged to have converged?
boundarylogical. Is the fitted value on the boundary of the
attainable values?
callthe matched call.
formulathe formula supplied.
termsthe terms
object used.
datathe data argument
.
offsetthe offset vector used.
controlthe value of the control
argument used.
methodthe name of the fitter function used (when provided as a
character
string to glm()
) or the fitter
function
(when provided as that).
contrasts(where relevant) the contrasts used.
xlevels(where relevant) a record of the levels of the factors
used in fitting.
na.action(where relevant) information returned by
model.frame
on the special handling of NA
s.
In addition, non-empty fits will have components qr, R
and effects relating to the final weighted linear fit.
Objects of class "glm" are normally of class c("glm",
"lm"), that is inherit from class "lm", and well-designed
methods for class "lm" will be applied to the weighted linear
model at the final iteration of IWLS. However, care is needed, as
extractor functions for class "glm" such as
residuals and weights do not just pick out
the component of the fit with the same name.
If a binomial glm model was specified by giving a
two-column response, the weights returned by prior.weights are
the total numbers of cases (factored by the supplied case weights) and
the component y of the result is the proportion of successes.