Learn R Programming

auditor (version 0.2.1)

plotResidualDensity: Residual Density Plot

Description

Density of model residuals.

Usage

plotResidualDensity(object, ..., variable = NULL)

Arguments

object

An object of class ModelAudit.

...

Other modelAudit objects to be plotted together.

variable

A variable name. Residuals will be plotted separately for different values of variable. or continuous variables, they will be separated by a median.

Value

ggplot object

See Also

plot.modelAudit

Examples

Run this code
# NOT RUN {
library(car)
lm_model <- lm(prestige~education + women + income, data = Prestige)
lm_au <- audit(lm_model, data = Prestige, y = Prestige$prestige)
plotResidualDensity(lm_au)

library(randomForest)
rf_model <- randomForest(prestige~education + women + income, data = Prestige)
rf_au <- audit(rf_model, data = Prestige, y = Prestige$prestige)
plotResidualDensity(lm_au, rf_au)

# }

Run the code above in your browser using DataLab