Skip to content

Fix risk ratio and risk difference formulas in misclassificationbias - #132

Merged
sbalci merged 1 commit into
sbalci:masterfrom
chenyangsu:fix/misclassificationbias-rr-rd
Nov 28, 2026
Merged

sbalci merged 1 commit into
sbalci:masterfrom
chenyangsu:fix/misclassificationbias-rr-rd

Conversation

@chenyangsu

Copy link
Copy Markdown
Contributor

On a 2x2 table (a=45, b=55, c=455, d=945) with senExposure=0.80, specExposure=0.90 (true counts 50, 50, 450, 950), misclassificationbias() returns adjusted RR 1.556 and RD 0.179 instead of 2.000 and 0.050. Since a, b are cases and c, d are controls, .computeEffects() conditions on outcome (a/(a+b), c/(c+d)) rather than exposure (a/(a+c), b/(b+d), Lash, Fox & Fink 2009).

Update .computeEffects(), sync vignettes/misclassificationbias-documentation.md, and add asymmetric-table tests. Happy to drop the vignette edit if you prefer.

Testing: testthat::test_file("tests/testthat/test-misclassificationbias.R") -> 13 passed, 0 failed.

@sbalci sbalci left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @chenyangsu. Confirmed: the rows are cases/controls, so the exposure risks are a/(a+c) and b/(b+d). Your fixture recovers RR 2.000 / RD 0.050, and the test file passes locally (13/13). The red checks are unrelated: an archived CRAN dependency (mltools), fixed separately.

@sbalci
sbalci merged commit 0c9ddb1 into sbalci:master Nov 28, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants