check {MDMA} | R Documentation |
Check model for influential cases
Description
Perform checks for a linear model regarding influential cases and collinearity numerically and graphically.
Usage
check(object, ...)
Arguments
object |
object of class |
... |
other parameters (none are used at the moment). |
Value
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:
predicted.value |
The value predicted by the model. |
residual |
The raw residual. |
std.residual |
The standardized residual. |
dfb.<...> |
DFBETAs for the variables in the model. |
dffit |
DFFIT value. |
cov.r |
Covariance ratio, a measure of change in the determinant of the coefficient covariance matrix. |
cook.d |
Cook's distance. |
hat |
Hat values. |
influential |
Determines whether a case is influential on any of the
measures |
- 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.
influential cases
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.
Author(s)
Mathijs Deen
Examples
lm.1 <- lm(mpg ~ disp + wt, data = mtcars)
check(lm.1)