Perform checks for a linear model regarding influential cases and collinearity numerically and graphically.
check(object, ...)
check
returns a list containing two matrices with statistics regarding
influential cases and a vector of variance inflation factors. Furthermore, it
produces diagnostics plots.
The return list contains three elements:
- influence
, a data.frame
, with observations in the model,
and the following variables:
The value predicted by the model.
The raw residual.
The standardized residual.
DFBETAs for the variables in the model.
DFFIT value.
Covariance ratio, a measure of change in the determinant of the coefficient covariance matrix.
Cook's distance.
Hat values.
Determines whether a case is influential on any of the
measures dfb.<...>
, dffit
, cov.r
, cook.d
or hat
.
See influential cases
for more information.
- is.infl
is a data.frame
indicating which influence measure(s)
is/are flagged per observation.
- vifs
, a vector containing variance inflation factors for the
variables in the model.
By default, the two data.frame
s regarding influence measures only give the influence
measures for cases that are flagged as being influential. Influence measures for all cases
can be queried using print.check.lm
.
The generated plots are the plots produced by plot.lm
, numbers 1 through 6.
object of class lm
.
other parameters (none are used at the moment).
For the influence indicators, the following rules are applied to check whether a case is influential:
\(\mathrm{any\enspace}|\mathrm{dfbeta}| > 1\).
\(|\mathrm{dffit}| > 3 \sqrt{\frac{k}{n-k}}\).
\(|1 - \mathrm{cov.r}| > \frac{3k}{n-k}\).
\(F\mathrm{(}n, n-k \mathrm{)} = \mathrm{cooks.d\enspace having\enspace}. p > .5\)
\(\mathrm{hat} > \frac{3k}{n}\).
These indicators for being an influential case were derived from
influence.measures
in the stats
package.
Mathijs Deen
lm.1 <- lm(mpg ~ disp + wt, data = mtcars)
check(lm.1)
Run the code above in your browser using DataLab