Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 16, 2024
1 parent 13c696f commit ad60db1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion R/check_overdispersion.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ check_overdispersion.glm <- function(x, verbose = TRUE, ...) {
# for certain distributions, simulated residuals are more accurate
use_simulated <- info$is_bernoulli || info$is_binomial || (!info$is_count && !info$is_binomial) || info$is_negbin

if (use_simulated) {
# model classes not supported in DHARMa
not_supported <- c("fixest", "glmx")

if (use_simulated && !inherits(x, not_supported)) {
return(check_overdispersion(simulate_residuals(x, ...), ...))
}

Expand Down
5 changes: 4 additions & 1 deletion R/check_zeroinflation.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ check_zeroinflation.default <- function(x, tolerance = 0.05, ...) {
return(NULL)
}

# model classes not supported in DHARMa
not_supported <- c("fixest", "glmx")

# for models with zero-inflation component or negative binomial families,
# we use simulated_residuals()
if (model_info$is_zero_inflated || model_info$is_negbin) {
if (!inherits(x, not_supported) && (model_info$is_zero_inflated || model_info$is_negbin)) {
if (missing(tolerance)) {
tolerance <- 0.1
}
Expand Down

0 comments on commit ad60db1

Please sign in to comment.