Currently three tests are performed - for outliers in residuals - for autocorrelation in target variable or in residuals - for trend in residuals as a function of target variable (detection of bias)

check_residuals(model, ...)

Arguments

model

An object of class `modelAudit`

...

other parameters that will be passed to further functions

Value

list with statistics for particualr checks

Examples

library(car)
#> Ładowanie wymaganego pakietu: carData
#> Warning: pakiet 'carData' został zbudowany w wersji R 3.5.2
lm_model <- lm(prestige ~ education + women + income, data = Prestige) lm_au <- audit(lm_model, data = Prestige, y = Prestige$prestige) check_residuals(lm_au)
#> ----------------------------------------------- #> Checks for autocorrelation #> ----------------------------------------------- #> Model name: lm #> Autocorrelation in target: +0.69 *** #> Autocorrelation in residuals: +0.15 . #> ----------------------------------------------- #> Checks for outliers #> ----------------------------------------------- #> Model name: lm #> Shift > 1: 0 ( 0 %) #> Shift > 2: 0 ( 0 %) #> Top lowest standardised residuals: #> -2.5649 (53), -2.1354 (46), -1.8837 (54), -1.8557 (41), -1.7617 (61) #> Top highest standardised residuals: #> 2.2648 (67), 2.1225 (82), 2.0597 (29), 1.8916 (31), 1.8274 (27) #> ----------------------------------------------- #> Checks for trend in residuals #> ----------------------------------------------- #> Model name: lm #> Standardised loess fit: +7.32 .
# NOT RUN { library("DALEX2") dragons <- DALEX2::dragons library("ranger") rf_model <- ranger(life_length ~ ., data = dragons) predict_function <- function(m,x,...) predict(m, x, ...)$predictions rf_au <- audit(rf_model, data = dragons, y = dragons$life_length, predict.function = predict_function) check_residuals(rf_au) # }