glm
Objects
glm
objects.
residuals.glm(object, type)This is a method for the function
residuals()
for objects inheriting
from class
"glm"
. However, as several types of residuals are
available for
glm
objects, there is an additional optional argument
type
.
"glm"
representing a fitted model.
"deviance"
,
"pearson"
,
"working"
or
"response"
; the first is the default.
y-fitted(object)
. The
summary()
method for
glm
objects produces deviance residuals.
The
residuals
component of a
glm
object contains the working residuals.
Chambers, J.M., and Hastie, T.J. (1991). Statistical Models in S, pp. 204--206.
kyph.glm <- glm(Kyphosis ~ ., binomial, kyphosis) plot(fitted(kyph.glm), resid(kyph.glm, type = "response"), ylab = "response residuals") #produce a matrix of partial residuals, one column for each term kyph.predict <- predict(kyph.glm, type = "terms") + kyph.glm$residuals par(mfrow=c(1,3)) plot(kyphosis$Age, kyph.predict[, "Age"], ylab = "partial residuals") plot(kyphosis$Start, kyph.predict[,"Start"], ylab="") plot(kyphosis$Number, kyph.predict[,"Number"],ylab="")