check.outlier: Statistical Measures for Leverage, Distance, and Influence

View source: R/check.outlier.R

check.outlierR Documentation

Statistical Measures for Leverage, Distance, and Influence

Description

This function computes statistical measures for leverage, distance, and influence for linear models estimated by using the lm() function. Mahalanobis distance and hat values are computed for quantifying leverage, standardized leverage-corrected residuals and studentized leverage-corrected residuals are computed for quantifying distance, and Cook's distance and DfBetas are computed for quantifying influence.

Usage

check.outlier(model, check = TRUE, ...)

Arguments

model

a fitted model of class "lm".

check

logical: if TRUE, argument specification is checked.

...

further arguments to be passed to or from methods.

Details

In regression analysis, an observation can be extreme in three major ways (see Darlington & Hayes, p. 484): (1) An observation has high leverage if it has a atypical pattern of values on the predictors, (2) an observation has high distance if its observed outcome value Y_i has a large deviation from the predicted value \hat{Y}_i, and (3) an observation has high influence if its inclusion substantially changes the estimates for the intercept and/or slopes.

Value

Returns a data frame with following entries:

idout

ID variable

mahal

Mahalanobis distance

hat

hat values

rstand

standardized leverage-corrected residuals

rstud

studentized leverage-corrected residuals

cook

Cook's distance

Intercept.dfb

DFBetas for the intercept

pred1.dfb

DFBetas for the slope of the predictor pred1

....dfb

DFBetas for the slope of the predictor ...

Author(s)

Takuya Yanagida takuya.yanagida@univie.ac.at

References

Darlington, R. B., &, Hayes, A. F. (2017). Regression analysis and linear models: Concepts, applications, and implementation. The Guilford Press.

See Also

check.collin, lm

Examples

dat <- data.frame(x1 = c(3, 2, 4, 9, 5, 3, 6, 4, 5, 6, 3, 5),
                  x2 = c(1, 4, 3, 1, 2, 4, 3, 5, 1, 7, 8, 7),
                  x3 = c(0, NA, 1, 0, 1, 1, NA, 1, 0, 0, 1, 1),
                  y = c(2, 7, 4, 4, 7, 8, 4, 2, 5, 1, 3, 8))

# Regression model and measures for leverage, distance, and influence
mod.lm <- lm(y ~ x1 + x2, data = dat)
check.outlier(mod.lm)

# Merge result table with the data
dat1 <- cbind(dat, check.outlier(mod.lm))

misty documentation built on Nov. 15, 2023, 1:06 a.m.

Related to check.outlier in misty...