Learn R Programming

api2lm (version 0.2)

outlier_test: Identify outliers

Description

outlier_test returns the observations identified as an outlier based on the Bonferroni correction for a studentized residuals.

Usage

outlier_test(model, n = stats::nobs(model), alpha = 0.05)

Value

A data frame with the outliers.

Arguments

model

A fitted model object from the lm function.

n

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

alpha

The Bonferroni-adjusted threshold at which an outlier is identified. The default is 0.05.

See Also

Examples

Run this code
lmod <- lm(price ~ sqft_living, data = home_sales)
outlier_test(lmod)
outlier_test(lmod, alpha = 1, n = 7)
lmod2 <- lm(Petal.Length ~ Sepal.Length + Species, iris)
outlier_test(lmod2)

Run the code above in your browser using DataLab