Skip to content

Commit a69036d

Browse files
committed
Expose influence function SE for cf_sensitivity/cf_specificity/cf_fpr
- Add 'influence' to se_method options for cf_sens_spec functions - Influence function SE requires cross_fit = TRUE (validated with error) - The implementation was already complete but not accessible in API
1 parent e98d7db commit a69036d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

R/cf_sens_spec.R

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ cf_sensitivity <- function(predictions,
9595
estimator = c("dr", "cl", "ipw", "naive"),
9696
propensity_model = NULL,
9797
outcome_model = NULL,
98-
se_method = c("none", "bootstrap"),
98+
se_method = c("none", "bootstrap", "influence"),
9999
n_boot = 200,
100100
conf_level = 0.95,
101101
cross_fit = FALSE,
@@ -108,6 +108,11 @@ cf_sensitivity <- function(predictions,
108108
estimator <- match.arg(estimator)
109109
se_method <- match.arg(se_method)
110110

111+
# Influence function SE requires cross-fitting
112+
if (se_method == "influence" && !cross_fit) {
113+
stop("Influence function standard errors require cross_fit = TRUE")
114+
}
115+
111116
# Parse propensity score trimming specification
112117
ps_trim_spec <- .parse_ps_trim(ps_trim)
113118

@@ -361,7 +366,7 @@ cf_specificity <- function(predictions,
361366
estimator = c("dr", "cl", "ipw", "naive"),
362367
propensity_model = NULL,
363368
outcome_model = NULL,
364-
se_method = c("none", "bootstrap"),
369+
se_method = c("none", "bootstrap", "influence"),
365370
n_boot = 200,
366371
conf_level = 0.95,
367372
cross_fit = FALSE,
@@ -374,6 +379,11 @@ cf_specificity <- function(predictions,
374379
estimator <- match.arg(estimator)
375380
se_method <- match.arg(se_method)
376381

382+
# Influence function SE requires cross-fitting
383+
if (se_method == "influence" && !cross_fit) {
384+
stop("Influence function standard errors require cross_fit = TRUE")
385+
}
386+
377387
# Parse propensity score trimming specification
378388
ps_trim_spec <- .parse_ps_trim(ps_trim)
379389

@@ -614,7 +624,7 @@ cf_fpr <- function(predictions,
614624
estimator = c("dr", "cl", "ipw", "naive"),
615625
propensity_model = NULL,
616626
outcome_model = NULL,
617-
se_method = c("none", "bootstrap"),
627+
se_method = c("none", "bootstrap", "influence"),
618628
n_boot = 200,
619629
conf_level = 0.95,
620630
cross_fit = FALSE,

0 commit comments

Comments
 (0)