Skip to content

Commit b004c2e

Browse files
committed
Add sensitivity, specificity, and ROC curve functions (v0.4.0)
New functions: - cf_sensitivity(), cf_specificity(), cf_fpr(), cf_tpr(), cf_tnr() - tr_sensitivity(), tr_specificity(), tr_fpr(), tr_tpr(), tr_tnr() - cf_roc(), tr_roc() with plot() and as.data.frame() methods Features: - Vectorized threshold parameter for efficient computation - CL, IPW, DR estimators for counterfactual functions - OM, IPW, DR estimators for transportable functions - ROC AUC via trapezoidal integration - Option to compare with naive estimates Also includes updated vignettes with ROC curve examples.
1 parent d53484d commit b004c2e

24 files changed

Lines changed: 5842 additions & 7 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: cfperformance
22
Title: Counterfactual Prediction Model Performance Estimation
3-
Version: 0.3.0
3+
Version: 0.4.0
44
Authors@R: c(
55
person("Christopher", "Boyer",
66
email = "cboyer@hsph.harvard.edu",

NAMESPACE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method(as.data.frame,cf_roc)
4+
S3method(as.data.frame,tr_roc)
35
S3method(coef,cf_performance)
46
S3method(coef,tr_performance)
57
S3method(confint,cf_performance)
68
S3method(confint,tr_performance)
79
S3method(plot,cf_auc)
810
S3method(plot,cf_calibration)
11+
S3method(plot,cf_roc)
912
S3method(plot,tr_calibration)
13+
S3method(plot,tr_roc)
1014
S3method(print,cf_compare)
1115
S3method(print,cf_cv)
16+
S3method(print,cf_fpr)
1217
S3method(print,cf_nuisance)
1318
S3method(print,cf_performance)
19+
S3method(print,cf_roc)
20+
S3method(print,cf_sensitivity)
21+
S3method(print,cf_specificity)
1422
S3method(print,ml_learner)
23+
S3method(print,tr_fpr)
1524
S3method(print,tr_performance)
25+
S3method(print,tr_roc)
26+
S3method(print,tr_sensitivity)
27+
S3method(print,tr_specificity)
1628
S3method(summary,cf_compare)
1729
S3method(summary,cf_cv)
1830
S3method(summary,cf_performance)
@@ -21,16 +33,30 @@ export(cf_auc)
2133
export(cf_calibration)
2234
export(cf_compare)
2335
export(cf_cv)
36+
export(cf_fpr)
2437
export(cf_mse)
38+
export(cf_roc)
39+
export(cf_sensitivity)
40+
export(cf_specificity)
41+
export(cf_tnr)
42+
export(cf_tpr)
2543
export(fit_nuisance)
2644
export(ml_learner)
2745
export(tr_auc)
2846
export(tr_calibration)
47+
export(tr_fpr)
2948
export(tr_mse)
49+
export(tr_roc)
50+
export(tr_sensitivity)
51+
export(tr_specificity)
52+
export(tr_tnr)
53+
export(tr_tpr)
3054
importFrom(grDevices,rgb)
3155
importFrom(graphics,abline)
3256
importFrom(graphics,hist)
3357
importFrom(graphics,layout)
58+
importFrom(graphics,legend)
59+
importFrom(graphics,lines)
3460
importFrom(graphics,par)
3561
importFrom(graphics,polygon)
3662
importFrom(rlang,.data)

NEWS.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
# cfperformance 0.4.0
2+
3+
Adds sensitivity, specificity, and ROC curve functions for both counterfactual
4+
and transportability settings.
5+
6+
## New Features
7+
8+
### Counterfactual Sensitivity/Specificity
9+
* `cf_sensitivity()` - Counterfactual sensitivity (true positive rate)
10+
* `cf_specificity()` - Counterfactual specificity (true negative rate)
11+
* `cf_fpr()` - Counterfactual false positive rate (1 - specificity)
12+
* `cf_tpr()` - Alias for `cf_sensitivity()`
13+
* `cf_tnr()` - Alias for `cf_specificity()`
14+
* Supports CL, IPW, DR, and naive estimators
15+
* Vectorized threshold parameter for efficient ROC curve computation
16+
17+
### Transportable Sensitivity/Specificity
18+
* `tr_sensitivity()` - Transportable sensitivity for target population
19+
* `tr_specificity()` - Transportable specificity for target population
20+
* `tr_fpr()` - Transportable false positive rate
21+
* `tr_tpr()` - Alias for `tr_sensitivity()`
22+
* `tr_tnr()` - Alias for `tr_specificity()`
23+
* Supports OM, IPW, DR, and naive estimators
24+
* Works with both "transport" and "joint" analysis types
25+
26+
### ROC Curves
27+
* `tr_roc()` - Compute transportable ROC curve in target population
28+
* `cf_roc()` - Compute counterfactual ROC curve
29+
* `plot.tr_roc()` / `plot.cf_roc()` - Plot ROC curves with AUC in legend
30+
* `as.data.frame.tr_roc()` / `as.data.frame.cf_roc()` - Convert to data frame for ggplot2
31+
* AUC computed via trapezoidal integration
32+
* Option to include naive ROC curve for comparison
33+
34+
### Documentation
35+
* Updated introduction vignette with ROC curve examples
36+
* Updated transportability vignette with ROC curve examples
37+
38+
---
39+
140
# cfperformance 0.3.0
241

342
Adds machine learning integration for flexible nuisance model estimation with

0 commit comments

Comments
 (0)