plot: Model Diagnostic Plots

plot_auditorR Documentation

Model Diagnostic Plots

Description

This function provides several diagnostic plots for regression and classification models. Provide object created with one of auditor's computational functions, model_residual, model_cooksdistance, model_evaluation, model_performance, model_evaluation.

Usage

plot_auditor(x, ..., type = "residual", ask = TRUE, grid = TRUE)

## S3 method for class 'auditor_model_residual'
plot(x, ..., type = "residual", ask = TRUE, grid = TRUE)

## S3 method for class 'auditor_model_performance'
plot(x, ..., type = "residual", ask = TRUE, grid = TRUE)

## S3 method for class 'auditor_model_halfnormal'
plot(x, ..., type = "residual", ask = TRUE, grid = TRUE)

## S3 method for class 'auditor_model_evaluation'
plot(x, ..., type = "residual", ask = TRUE, grid = TRUE)

## S3 method for class 'auditor_model_cooksdistance'
plot(x, ..., type = "residual", ask = TRUE, grid = TRUE)

Arguments

x

object of class auditor_model_residual (created with model_residual function), auditor_model_performance (created with model_performance function), auditor_model_evaluation (created with model_evaluation function), auditor_model_cooksdistance (created with model_cooksdistance function), or auditor_model_halfnormal (created with model_halfnormal function).

...

other arguments dependent on the type of plot or additional objects of classes 'auditor_model_residual', 'auditor_model_performance', 'auditor_model_evaluation', 'auditor_model_cooksdistance', 'auditor_model_halfnormal'.

type

the type of plot. Character or vector of characters. Possible values: 'acf', 'autocorrelation', 'cooksdistance', 'halfnormal', 'lift', 'pca', 'radar', 'correlation', 'prediction', 'rec', 'resiual', 'residual_boxplot','residual_density', 'roc', 'rroc', 'scalelocation', 'tsecdf' (for detailed description see corresponding functions in see also section).

ask

logical; if TRUE, the user is asked before each plot, see par(ask=).

grid

logical; if TRUE plots will be plotted on the grid.

Value

A ggplot object.

See Also

plot_acf, plot_autocorrelation, plot_cooksdistance, plot_halfnormal, plot_residual_boxplot, plot_lift, plot_pca, plot_radar, plot_correlation, plot_prediction, plot_rec, plot_residual_density, plot_residual, plot_roc, plot_rroc, plot_scalelocation, plot_tsecdf

Examples

dragons <- DALEX::dragons[1:100, ]

# fit a model
model_lm <- lm(life_length ~ ., data = dragons)

lm_audit <- audit(model_lm, data = dragons, y = dragons$life_length)

# validate a model with auditor
mr_lm <- model_residual(lm_audit)

# plot results
plot(mr_lm)
plot(mr_lm, type = "prediction")

hn_lm <- model_halfnormal(lm_audit)
plot(hn_lm)

library(randomForest)
model_rf <- randomForest(life_length~., data = dragons)
rf_audit <- audit(model_rf, data = dragons, y = dragons$life_length)

mp_rf <- model_performance(rf_audit)
mp_lm <- model_performance(lm_audit)
plot(mp_lm, mp_rf)


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