Skip to content

Commit

Permalink
Error: check_model() not implemented for models of class lm yet (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke authored Sep 29, 2023
1 parent 39e098b commit 05336ec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: performance
Title: Assessment of Regression Models Performance
Version: 0.10.5.4
Version: 0.10.5.5
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
the previous method, which used `parallel::detectCores()`. Now you should
set the number of cores via `options(mc.cores = 4)`.

## Bug fixes

* Fixed issues is `check_model()` for models that used data sets with
variables of class `"haven_labelled"`.

# performance 0.10.5

## Changes to functions
Expand Down
8 changes: 4 additions & 4 deletions R/check_model_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
# prepare data for normality of residuals plot ----------------------------------

.diag_norm <- function(model, verbose = TRUE) {
r <- try(stats::residuals(model), silent = TRUE)
r <- try(as.numeric(stats::residuals(model)), silent = TRUE)

if (inherits(r, "try-error")) {
insight::format_alert(sprintf("Non-normality of residuals could not be computed. Cannot extract residuals from objects of class '%s'.", class(model)[1]))
Expand Down Expand Up @@ -183,7 +183,7 @@
n_params <- tryCatch(model$rank, error = function(e) insight::n_parameters(model))

infl <- stats::influence(model, do.coef = FALSE)
resid <- insight::get_residuals(model)
resid <- as.numeric(insight::get_residuals(model))

std_resid <- tryCatch(stats::rstandard(model, infl), error = function(e) resid)

Expand Down Expand Up @@ -212,8 +212,8 @@
ncv <- tryCatch(
{
data.frame(
x = stats::fitted(model),
y = stats::residuals(model)
x = as.numeric(stats::fitted(model)),
y = as.numeric(stats::residuals(model))
)
},
error = function(e) {
Expand Down

0 comments on commit 05336ec

Please sign in to comment.