Skip to content

Compare diagnostics across models

Source: man/compareModelDiagnostics.Rd ยท Help: ?compareModelDiagnostics

Runs runDiagnostics for multiple models and collects test statistics. Diagnostics that cannot be computed (for example, due to validation failures) emit warnings and fill the corresponding entries with NA_real_. The original error messages are preserved on the returned data frame via the diagnostic_errors attribute.

Usage

compareModelDiagnostics(models, data = NULL, tests = c("white", "koenker"))

Arguments

models
List of fitted models or formulas.
data
Optional data frame when formulas are supplied.
tests
Diagnostics to run. Defaults to the White and Koenker tests, the default of runHeteroTests; it was the White and the classical Breusch-Pagan tests up to 0.14.0.

Value

A data frame of statistics, one row per model. Failed diagnostics are represented by NA_real_ entries and the underlying error messages can be retrieved from the diagnostic_errors attribute.

See also

analyzeMLResiduals

Examples

 data(mtcars)
 m1 <- lm(mpg ~ wt + qsec, mtcars)
 m2 <- lm(mpg ~ wt + hp, mtcars)
 compareModelDiagnostics(list(m1, m2))