diff --git a/R/check_outliers.R b/R/check_outliers.R index 9234796fb..161bc65e7 100644 --- a/R/check_outliers.R +++ b/R/check_outliers.R @@ -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) @@ -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, @@ -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 @@ -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