lm.influence
Regression Diagnostics
Description
Gives the statistics used in measuring the influence of the
observations on the original fit.
Usage
lm.influence(model, do.coef = TRUE)
influence(model, ...)
## S3 method for class 'lm':
influence(model, do.coef = TRUE, ...)
## S3 method for class 'glm':
influence(model, do.coef = TRUE, ...)
Arguments
model |
an lm or glm object, or an object of a class inheriting
from "lm" or "glm".
|
do.coef |
logical value. If TRUE, then coefficients are required in return value.
|
... |
other arguments pass to or from function/methods.
Currently, it is reserved for future use.
|
Details
lm.influence is main implementation to give the statistics used in measuring
the influence of the observations on the original fit. It is an utility called by both S3 methods
of generic function influence. These two hidden S3 methods are implemented
for class "lm" and "glm".
influence.lm just simply calls the lm.influence with the same
arguments and returns the value. Therefore, they have the same values.
influence.glm also calls the lm.influence with the same
arguments, but does two changes in returned list object: the component name "wt.res" is
changed to "dev.res" and a new component "pear.res" is appended.
Value
a list with components as below, giving statistics used in measuring the influence of the
observations on the original fit. Suppose the original fit had
n observations and p coefficients.
hat |
a named vector contains the diagonal of the hat (projection) matrix.
|
coefficients |
an n by p matrix of changes in the estimated coefficients,
which has as i-th row the estimated regression coefficients
when the i-th case is omitted from the regression.
|
sigma |
a named vector which i-th element contains an estimation of the residual standard
deviation for the model with the i-th case omitted.
|
wt.res (or dev.res) |
a named vector of weighted residuals. Or deviance residuals for GLM model.
|
pear.res |
only available for GLM model. A named vector of Pearson residuals.
The na.action of model is applied to this residuals.
|
References
Belsley, D. A., Kuh, E., and Welsch, R. E. 1980. Regression Diagnostics. New York, NY: John Wiley & Sons.
Chambers, J. M. and Hastie, T .J. (Eds.) 1992. Linear models. Statistical Models in S. Pacific Grove, CA.: Wadsworth & Brooks/Cole. Chapter 4.
Cook, R. D. and Weisberg, S. 1982. Statistical Models in S. London, UK: Chapman and Hall.
Fox, J. 1997. Applied Regression, Linear Models, and Related Methods. London, UK: Chapman and Hall.
Fox, J. 2002. An R and S-Plus Companion to Applied Regression. Thousand Oaks, CA: Sage Publications.
Williams, D. A. 1987. Generalized linear model diagnostics using the deviance and single case deletions. Applied Statistics. Volume 36. 181-191.
See Also
Examples
lm.freeny <- lm(y ~ ., data=Sdatasets::freeny)
lm.inf <- lm.influence(lm.freeny)
print(lm.inf)
influence(lm.freeny) # Same result as above.
# GLM example
ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
SF <- cbind(numdead, numalive = 20 - numdead)
budworm.lg <- glm(SF ~ sex*ldose, family = binomial)
influence(budworm.lg)