model_cooksdistance: Cook's distances

View source: R/model_cooksdistance.R

model_cooksdistanceR Documentation

Cook's distances

Description

Calculates Cook's distances for each observation. Please, note that it will work only for functions with specified update method.

Usage

model_cooksdistance(object)

observationInfluence(object)

Arguments

object

An object of class explainer created with function explain from the DALEX package.

Value

An object of the class auditor_model_cooksdistance.

References

Cook, R. Dennis (1977). "Detection of Influential Observations in Linear Regression". doi:10.2307/1268249.

Examples

data(titanic_imputed, package = "DALEX")

# fit a model
model_glm <- glm(survived ~ ., family = binomial, data = titanic_imputed)

# use DALEX package to wrap up a model into explainer
glm_audit <- audit(model_glm,
                   data = titanic_imputed,
                   y = titanic_imputed$survived)

# validate a model with auditor
mc <- model_cooksdistance(glm_audit)
mc

plot(mc)


auditor documentation built on Nov. 2, 2023, 6:13 p.m.