coefficients(object, ...) coef(object, ...) residuals(object, ...) resid(object, ...) fitted.values(object, ...) fitted(object, ...)
object
.
While for some models this will be identical to the component of the
object with the same name, you are encouraged to use the extractor
functions, since these will call the appropriate method for this
class of object.
For example, residuals from generalized linear models come in four flavors,
and the typically most useful one is
not the component.
The
"coef"
function has the following methods:
arima
,
bdGlm
,
bdLm
,
corAR1
,
corAR1Nat
,
corARMA
,
corARMANat
,
corBand
,
corBandNat
,
corCAR1
,
corCAR1Nat
,
corCompSymm
,
corCompSymmNat
,
corIdent
,
corLin
,
corSpatial
,
corSpatialNat
,
corSpher
,
corStrat
,
corStruct
,
corSymm
,
corSymmNat
,
default
,
discrim
,
gls
,
gnls
,
listof
,
lm
,
lmList
,
lmRobMM
,
lme
,
mlm
,
modelStruct
,
ms
,
nls
,
pdBand
,
pdBandNat
,
pdBlocked
,
pdCompSymm
,
pdCompSymmNat
,
pdDiag
,
pdDiagNat
,
pdIdent
,
pdIdentNat
,
pdKron
,
pdMat
,
pdStrat
,
pdSymm
,
pdSymmNat
,
reStruct
,
summary.nlsList
,
varComb
,
varConstPower
,
varConstPowerNat
,
varExp
,
varFixed
,
varFunc
,
varIdent
,
varIdentNat
,
varPower
,
varcomp
The
"residuals"
function has the following methods:
arima
,
bdGlm
,
bdLm
,
censorReg
,
coxph
,
coxph.null
,
coxph.penal
,
default
,
factanal
,
glm
,
gls
,
glsStruct
,
gnlsStruct
,
lm
,
lmList
,
lmRobMM
,
lme
,
lmeStruct
,
nlmeStruct
,
nls
,
survReg
,
survReg.penal
,
survreg
,
tree
The
"fitted"
function has the following methods:
arima
,
bdCluster
,
bdGlm
,
bdLm
,
bdPrincomp
,
censorRegList
,
default
,
factanal
,
gls
,
glsStruct
,
gnlsStruct
,
lmList
,
lme
,
lmeStruct
,
nlmeStruct
,
nls
,
survReg
,
values
As a special inducement to use the extractor function rather than the component,
three abbreviated versions of these functions exist; namely,
coef()
,
resid()
, and
fitted()
.
When a model is over-specified, the standard fitting method permutes
the columns of the model matrix and so the corresponding coefficients
and effects.
This is another case in which the components for these quantities behave
a little differently from the values of the corresponding functions.
If
fit
is a fitted, over-determined model, then
coef(fit)
gives back
only the full-rank part of the coefficients, while
fit$coef
gives back
coefficients for all the columns in the original model matrix.
In the latter case, elements that are aliased with earlier degrees of
freedom come out as
NA
.
In breaking down the coefficients or effects by terms, the distinction
also comes up.
The component
assign
refers to the original model matrix, so it
defines the degrees of freedom in
fit$coef
.
Another component,
R.assign
is produced in the singular case to
index terms in the
R
matrix, and also in
coef(fit)
.
See
lm.object
for more details.
kyph.glm1 <- glm(Kyphosis ~ Age + Start + Number, family = binomial, data = kyphosis) coef(kyph.glm1) # produces the following output: (Intercept) Age Start Number -2.036932 0.01093048 -0.20651 0.410601 residuals(kyph.glm1) # produces the following output: 1 2 3 4 5 -0.7707923 -0.5111615 1.189314 -1.106713 -0.2461915 . . .