Repository navigation
Fix risk ratio and risk difference formulas in misclassificationbias - #132
Merged
Merged
Conversation
sbalci
approved these changes
Nov 28, 2026
sbalci
left a comment
Owner
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a 2x2 table (
a=45, b=55, c=455, d=945) withsenExposure=0.80, specExposure=0.90(true counts50, 50, 450, 950),misclassificationbias()returns adjusted RR1.556and RD0.179instead of2.000and0.050. Sincea, bare cases andc, dare 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(), syncvignettes/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.