Support binary outcomes in simulate_dyad_responses() and the predictive checks
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 66/100
Research direction
Start in R/predictive_checks_simulation.R (simulate_dyad_responses()): add "binomial" to supported, keep only the successes column of glmmTMB draws, convert logical/two-level-factor responses to 0/1, and error on non-0/1 responses; then add "binomial" to count_families in R/predictive_checks_outcomes.R. Verify with tests/testthat/test-predictive-checks-generalized.R, test-simulate-dyad-responses.R and test-predictive-checks-outcomes.R. Note the issue is blocked on #77, and simulation studies under dev/diagnostic_checks/simulation-studies/ must be rerun per its README before updating reports and NEWS.md.
Written by the indexing model from the issue text.
Description
simulate_dyad_responses() rejects binomial() models ("Unsupported family"), so no check_*() function works for binary outcomes. A quick test on the branch of #77 showed that check_partner_dependence(), check_residuals() and check_outcomes() all run on a 0/1 model after a small change to the simulation. Do this after #77 is merged.
Scope: ungrouped 0/1 outcomes only (numeric 0/1, logical, or a two-level factor). Keep rejecting grouped binomial models (cbind(successes, failures)) and weighted proportions.
Code
R/predictive_checks_simulation.R,simulate_dyad_responses():- Add
"binomial"tosupported. - glmmTMB returns successes and failures for each draw. Keep successes:
if (family$family == "binomial") simulated[] <- lapply(simulated, function(x) x[, 1]) - Convert a logical or two-level factor response to 0/1 (first factor level = 0, as in glmmTMB).
- Stop with a clear message if the response is not 0/1.
- Add
binomial()(0/1 outcomes) under "Supported models" in the help, then rundevtools::document().
- Add
R/predictive_checks_outcomes.R: add"binomial"tocount_families, so the outcome page shows bars for 0 and 1 instead of an ECDF. Decide whether to hide the "Number of zeros" row for binary outcomes, since it repeats the bar for 0.check_residuals()andcheck_partner_dependence()should need no changes. Confirm that residual centring applies (free_conditional_interceptisTRUEfor models with an intercept).
Tests
tests/testthat/test-predictive-checks-generalized.R: addbinomial()with a 0/1 outcome to the family loop, so all three checks run. Keep the grouped-binomial test (update its expected message if it changes). Add tests for logical and factor outcomes, and for rejecting outcomes that are not 0/1.tests/testthat/test-simulate-dyad-responses.R: simulations are annsim× n matrix of 0/1; observed values are 0/1.tests/testthat/test-predictive-checks-outcomes.R: bars for 0 and 1.
Simulation studies
Run from the repository root as described in dev/diagnostic_checks/simulation-studies/README.md.
dev/diagnostic_checks/simulation-studies/shared/family-margins.R: add a Bernoulli margin (logit link).family-comparison/andgeneralized-covariance-pooling/: addbinomialto their family lists, rerun, and updatereport-data/and the reports invignettes/articles/.dev/diagnostic_checks/distribution-diagnostics/calibration-check.R: add a binary scenario (correct model, and one with an omitted role mean). Record false alarms and detection rates incalibration-summary.md.
Docs
NEWS.md: one bullet.- Optional: an example in the empty "Dichotomous outcomes" section of
dev/vignettes/generalized-apim.Rmd.
- Dominant language
- R
- Stars
- 1
- Forks
- 2
- Avg merge
- 9h 28m
- Merged PRs (30d)
- 21
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 Pascal-Kueng/dyadMLM
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Pascal-Kueng/dyadMLM#92 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Pascal-Kueng/dyadMLM#83 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Pascal-Kueng/dyadMLM#71 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Pascal-Kueng/dyadMLM#70 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Pascal-Kueng/dyadMLM#69 ·
Maintainers usually reply within 1 day
All issues in Pascal-Kueng/dyadMLM
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
bennettoxford/opencodecounts#170 ·
-
complexity::1-low effort::1-hours priority::3-could
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jumpingrivers/audit.workbench#43 ·
Maintainers usually reply within 1 day
-
complexity::1-low effort::1-hours priority::3-could
Difficulty 1/5 Under an hour Newbie friendliness 85/100
jumpingrivers/audit.connect#71 ·
Maintainers usually reply within 1 day
-
bug complexity::1-low effort::1-hours priority::2-should
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
jumpingrivers/audit.base#61 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pharmaverse/admiraldev#580 ·