Cannot check model from mgcv and categorical outcome

Open
#794 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
testing-qa

Research direction

Start by running the reproducible mgcv::gam example with performance::check_model() and inspect the handling of categorical outcomes from mgcv::ocat models. Done means check_model(model) completes without the dimensionality error and produces the diagnostic plot shown in the report.

Written by the indexing model from the issue text.

Description

Bug :bug:

Reproducible example:

library(mgcv)
library(performance)

df <- mtcars |>
  tibble::as_tibble() |>
  dplyr::mutate(carb = as.integer(carb))

model <- mgcv::gam(
  carb~s(wt, k=5),
  data = df,
  family = mgcv::ocat(R=8)
)

plot(check_model(model))

Error:

Error in d[, !(names(data) %in% all.varying), drop = FALSE] : 
  incorrect number of dimensions

It seems that there is something wrong when using mgcv and ocat. Nevertheless, I can use MASS and ordinal regression:

df <- mtcars |>
  tibble::as_tibble() |>
  dplyr::mutate(carb = as.factor(carb))
model <- MASS::polr(
  carb~wt,
  data = df,
  Hess = TRUE
)
plot(check_model(model))
Dominant language
R
Stars
1.2k
Forks
113
Avg merge
9h 8m
Merged PRs (30d)
27

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from easystats/performance

All issues in easystats/performance

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.