Ordered fix - #142
Open
xrobin wants to merge 9 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #142 +/- ##
===========================================
+ Coverage 87.36% 87.52% +0.16%
===========================================
Files 40 40
Lines 4146 4312 +166
===========================================
+ Hits 3622 3774 +152
- Misses 524 538 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Fixes #63. Ordered predictors such as
aSAH$wfnsare no longer coerced tonumeric codes. Thresholds are the factor levels plus an Inf sentinel
(
"Inf"or"-Inf"depending on direction), and lookup is by label.This is a breaking change for code that reads
roc$thresholdsorpasses numeric cut-offs into
coords(),ci.thresholds(),ci.coords(),or
plot.roc(print.thres)on an ordered ROC. Sensitivity, specificity,and AUC match the old numeric conversion; only the cut-off labels change.
Numeric predictors are unchanged (midpoints,
coords(roc, 0.55), etc.).Also fixes
ci.coords(..., x = "best", best.policy = "omit"), whichreturned the first column of the coords data.frame instead of dropping
the replicate. That bug was not ordered-specific.
Behavior
(
>=whendirection = "<",<=whendirection = ">").direction = "<": thresholds arec(levels, Inf);">":c(-Inf, levels).next occupied level toward the positive class).
casesandcontrolsmust have identicallevels(). Orderedcases/controls now build
predictor/responsein the same order(controls then cases), which fixes non-stratified bootstrap and
Venkatraman on that interface.
ci.coords()omits the threshold interval by default on ordered curves(labels are not numeric).
ret = "threshold"is still accepted, returnsNA, and warns.
"a"vs"all").If a string is both a keyword and a level, the keyword wins with a warning.
Test plan
roc(aSAH$outcome, aSAH$wfns)thresholds are ordered levels + Inf,not midpoints; AUC equals
roc(..., as.numeric(wfns))."very low"…"very high") round-trip throughcoords(),ci.thresholds(),ci.coords(),plot(print.thres).x/print.thres/thresholdson an ordered ROC errors.coords(r, 0.55)and
plot(r, print.thres = 0.55)unchanged.ci.coords(r_tie, "best", best.policy = "omit")on a curve withseveral Youden points drops those replicates (row of NAs) instead
of returning the threshold column.
devtools::test()/R CMD checkPost-test communication