binned_residuals() fails for models fitted with na.action = na.exclude
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- r
- Domain
- data-visualization, machine-learning, testing-qa
Research direction
Start with the binned_residuals() implementation and reproduce the provided glm() example with na.action = na.exclude. Inspect the existing test-check_model.R cases, including the overdispersion tests, then add a regression test for the missing-predictor case. Done means excluded observations are handled without length mismatch, binned_residuals(m) succeeds, and the check_model() Binned Residuals panel is shown.
Written by the indexing model from the issue text.
Description
binned_residuals() errors for a logistic regression fitted with na.action = na.exclude when a predictor has a missing value:
library(performance)
d <- transform(mtcars, x = replace(wt, 1, NA_real_))
m <- glm(am ~ x, data = d, family = binomial, na.action = na.exclude)
binned_residuals(m)
#> Error in binned_residuals(m): 'x' must be nonnegative and integer
#> In addition: Warning message:
#> In y0 - fitted_values :
#> longer object length is not a multiple of shorter object length
The response still includes the excluded row, but the fitted values don't, so the two vectors have different lengths. With the default na.omit it works. check_model() calls binned_residuals() inside .safe(), so for these models the Binned Residuals panel just goes missing without a message. The package's tests already use na.exclude with glm fits in check_model() (test-check_model.R, the overdispersion tests).
- Dominant language
- R
- Stars
- 1.2k
- Forks
- 113
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from easystats/performance
-
Waiting for response :love_letter:
Difficulty 3/5 1-2 days Newbie friendliness 62/100
easystats/performance#1005 · 1 comment ·
Maintainers usually reply within 1 day
-
misleading subtitle with check_heteroscedasticity with binomial data?Possibly taken @jmgirard claimed this 26 days ago. OpenConsistency :green_apple: :apple: Docs :books:
easystats/performance#1003 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
`check_outliers()`: Cook's distances land on the wrong rows when the model skips or reorders rowsOpen3 investigators :grey_question::question: Bug :bug:
Difficulty 4/5 3-5 days Newbie friendliness 22/100
easystats/performance#981 · 1 comment ·
Maintainers usually reply within 1 day
-
Docs :books: Enhancement :boom:
Difficulty 5/5 Over a week Newbie friendliness 45/100
easystats/performance#901 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Enhancement :boom:
Difficulty 4/5 3-5 days Newbie friendliness 35/100
easystats/performance#891 ·
Maintainers usually reply within 1 day
All issues in easystats/performance
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ThinkR-open/mordew#89 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
epiforecasts/EpiNow2#1694 · 2 reactions ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
easystats/correlation#403 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
mitchelloharawild/mixtime#111 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
conda-forge/xgboost-feedstock#313 ·