Skip to content

check_model failing on logistic regression #701

Closed
@bbolker

Description

It's possible that this will get sorted out as part of the process of checking/validating #698, but I thought I would report it in case it gets missed.

## remotes::install_github("easystats/performance")
## remotes::install_github("easystats/performance", ref = remotes::github_pull(698))
mm <- transform(mtcars, bigcyl = as.numeric(cyl > 2))
m <- glm(bigcyl ~ mpg, data = mm, family = binomial)
performance::check_model(m)

This triggers an error from ggplot2,

dim(data) must return an of length 2.

At this point data is:

 class(data)
[1] "performance_simres"     "see_performance_simres" "DHARMa"                
Browse[2]> where
where 1: .prevalidate_data_frame_like_object(data)
where 2: validate_as_data_frame(model)
where 3: withCallingHandlers(expr, condition = function(cnd) {
    {
        .__handler_frame__. <- TRUE
        .__setup_frame__. <- frame
        if (inherits(cnd, "message")) {
            except <- c("warning", "error")
        }
        else if (inherits(cnd, "warning")) {
            except <- "error"
        }
        else {
            except <- ""
        }
    }
    while (!is_null(cnd)) {
        if (inherits(cnd, "error")) {
            out <- handlers[[1L]](cnd)
            if (!inherits(out, "rlang_zap")) 
                throw(out)
        }
        inherit <- .subset2(.subset2(cnd, "rlang"), "inherit")
        if (is_false(inherit)) {
            return()
        }
        cnd <- .subset2(cnd, "parent")
    }
})
where 4: doTryCatch(return(expr), name, parentenv, handler)
where 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 6: tryCatchList(expr, classes, parentenv, handlers)
where 7: tryCatch(withCallingHandlers(expr, condition = function(cnd) {
    {
        .__handler_frame__. <- TRUE
        .__setup_frame__. <- frame
        if (inherits(cnd, "message")) {
            except <- c("warning", "error")
        }
        else if (inherits(cnd, "warning")) {
            except <- "error"
        }
        else {
            except <- ""
        }
    }
    while (!is_null(cnd)) {
        if (inherits(cnd, "error")) {
            out <- handlers[[1L]](cnd)
            if (!inherits(out, "rlang_zap")) 
                throw(out)
        }
        inherit <- .subset2(.subset2(cnd, "rlang"), "inherit")
        if (is_false(inherit)) {
            return()
        }
        cnd <- .subset2(cnd, "parent")
    }
}), stackOverflowError = handlers[[1L]])
where 8: try_fetch(validate_as_data_frame(model), error = function(cnd) cli::cli_abort(glue(msg0), 
    parent = cnd))
where 9: fortify.default(data, ...)
where 10: fortify(data, ...)
where 11: ggplot.default(x, ggplot2::aes(x = .data$x, y = .data$y))
where 12: ggplot2::ggplot(x, ggplot2::aes(x = .data$x, y = .data$y))
where 13: .plot_diag_qq(x$QQ, size_point, size_line, alpha_level = alpha_level, 
    detrend = detrend, theme_style = style, colors = colors, 
    dot_alpha_level = dot_alpha_level, show_dots = TRUE, model_info = model_info, 
    model_class = model_class)
where 14: plot.see_check_model(x, style = style, colors = colors, type = type, 
    n_colums = n_columns, ...)
where 15: NextMethod()
where 16: plot.check_model(x, style = style, colors = colors, type = type, 
    n_colums = n_columns, ...)
where 17: graphics::plot(x, style = style, colors = colors, type = type, 
    n_colums = n_columns, ...)
where 18: withCallingHandlers(expr, message = function(c) if (inherits(c, 
    classes)) tryInvokeRestart("muffleMessage"))
where 19: suppressMessages(graphics::plot(x, style = style, colors = colors, 
    type = type, n_colums = n_columns, ...))
where 20: withCallingHandlers(expr, warning = function(w) if (inherits(w, 
    classes)) tryInvokeRestart("muffleWarning"))
where 21: suppressWarnings(suppressMessages(graphics::plot(x, style = style, 
    colors = colors, type = type, n_colums = n_columns, ...)))
where 22: print.see_check_model(x)
where 23: NextMethod()
where 24: print.check_model(x)
where 25: (function (x, ...) 
UseMethod("print"))(x)
where 26: check_model.default(m)
where 27: performance::check_model(m)

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions