ols_plot_cooksd_bar: Cooks' D bar plot

Description Usage Arguments Details Value Deprecated Function See Also Examples

View source: R/ols-cooks-d-barplot.R

Description

Bar Plot of cook's distance to detect observations that strongly influence fitted values of the model.

Usage

1
ols_plot_cooksd_bar(model, print_plot = TRUE)

Arguments

model

An object of class lm.

print_plot

logical; if TRUE, prints the plot else returns a plot object.

Details

Cook's distance was introduced by American statistician R Dennis Cook in 1977. It is used to identify influential data points. It depends on both the residual and leverage i.e it takes it account both the x value and y value of the observation.

Steps to compute Cook's distance:

A data point having a large cook's d indicates that the data point strongly influences the fitted values.

Value

ols_plot_cooksd_bar returns a list containing the following components:

outliers

a data.frame with observation number and cooks distance that exceed threshold

threshold

threshold for classifying an observation as an outlier

Deprecated Function

ols_cooksd_barplot() has been deprecated. Instead use ols_plot_cooksd_bar().

See Also

[ols_plot_cooksd_chart()]

Examples

1
2
model <- lm(mpg ~ disp + hp + wt, data = mtcars)
ols_plot_cooksd_bar(model)

olsrr documentation built on Feb. 10, 2020, 5:07 p.m.