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:
coefficients
a named vector of coefficients
residuals
the
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.values
the fitted mean values, obtained by transforming
the linear predictors by the inverse of the link function.
rank
the numeric rank of the fitted linear model.
family
the
family
object used.
linear.predictors
the linear fit on link scale.
deviance
up to a constant, minus twice the maximized
log-likelihood. Where sensible, the constant is chosen so that a
saturated model has deviance zero.
aic
A 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.deviance
The 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.
iter
the number of iterations of IWLS used.
weights
the
working
weights, that is the weights
in the final iteration of the IWLS fit.
prior.weights
the weights initially supplied, a vector of
1
s if none were.
df.residual
the residual degrees of freedom.
df.null
the residual degrees of freedom for the null model.
y
if requested (the default) the
y
vector
used. (It is a vector even for a binomial model.)
x
if requested, the model matrix.
model
if requested (the default), the model frame.
converged
logical. Was the IWLS algorithm judged to have converged?
boundary
logical. Is the fitted value on the boundary of the
attainable values?
call
the matched call.
formula
the formula supplied.
terms
the
terms
object used.
data
the
data argument
.
offset
the offset vector used.
control
the value of the
control
argument used.
method
the 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.