Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Nov 24, 2024
1 parent e0e83d9 commit a5ca716
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions R/check_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ check_outliers.default <- function(x,
several.ok = TRUE
)

# Get model information
m_info <- insight::model_info(x)

# Get data
my_data <- insight::get_data(x, verbose = FALSE)

Expand All @@ -405,8 +408,12 @@ check_outliers.default <- function(x,
)
}

# Remove non-numerics, but only check predictors
model_predictors <- unique(insight::find_predictors(x, flatten = TRUE))
# Remove non-numerics, but in case of binomial, only check predictors
if (m_info$is_binomial) {
model_predictors <- unique(insight::find_predictors(x, flatten = TRUE))
} else {
model_predictors <- colnames(my_data)
}
my_data <- datawizard::data_select(
my_data[model_predictors],
select = is.numeric,
Expand Down Expand Up @@ -451,7 +458,7 @@ check_outliers.default <- function(x,
}

# Cook
if ("cook" %in% method && !insight::model_info(x)$is_bayesian && !inherits(x, "bife")) {
if ("cook" %in% method && !m_info$is_bayesian && !inherits(x, "bife")) {
data_cook <- .check_outliers_cook(
x,
threshold = thresholds$cook
Expand Down Expand Up @@ -491,7 +498,7 @@ check_outliers.default <- function(x,
}

# Pareto
if ("pareto" %in% method && insight::model_info(x)$is_bayesian) {
if ("pareto" %in% method && m_info(x)$is_bayesian) {
data_pareto <- .check_outliers_pareto(
x,
threshold = thresholds$pareto
Expand Down

0 comments on commit a5ca716

Please sign in to comment.