cooks_test: Identify influential observations

View source: R/cooks_test.R

cooks_testR Documentation

Identify influential observations

Description

cooks_test returns the observations identified as influential based on the cooks statistics being larger than a threshold.

The threshold for this test is the 0.5 quantile of a F_{p, n-p} distribution where p = length(stats::coef(model)) and n - p = stats::df.residual(model).

Usage

cooks_test(model, n = stats::nobs(model))

Arguments

model

A fitted model object from the lm function.

n

The number of outliers to return. The default is all influential observations.

Value

A vector of influential observations.

See Also

cooks.distance

Examples

lmod <- lm(price ~ sqft_living, data = home_sales)
cooks_test(lmod)

api2lm documentation built on July 9, 2023, 5:52 p.m.