Skip to content

Commit 6760d6f

Browse files
committed
added an empty estimate_var_sandwich() option as a placeholder for a sandwich estimator alternative to sample-based variances. See Issue #30
1 parent 6095091 commit 6760d6f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

R/IPD_stats.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,22 @@ IPD_stats.mim <- function(strategy,
8989
#'
9090
IPD_stat_factory <- function(ipd_fun) {
9191

92-
function(strategy, ipd, ald, scale, ...) {
92+
function(strategy, ipd, ald, scale,
93+
var_method = "sample", ...) {
94+
9395
out <- ipd_fun(strategy, ipd, ald, ...)
9496

9597
hat.delta.AC <- calculate_ate(out$mean_A, out$mean_C,
9698
effect = scale)
9799

98100
coef_est <- mean(hat.delta.AC)
99-
var_est <- var(hat.delta.AC)
101+
102+
if (var_method == "sandwich") {
103+
##TODO:
104+
var_est <- estimate_var_sandwich(strategy, ipd_data, ...)
105+
} else if (var_method == "sample") {
106+
var_est <- var(hat.delta.AC)
107+
}
100108

101109
list(mean = coef_est,
102110
var = var_est)

R/estimate_var_sandwich.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
#' Estimate Variance Sandwich Estimator
3+
#'
4+
estimate_var_sandwich <- function(strategy, ipd_data, ...) {
5+
6+
##TODO:
7+
}

0 commit comments

Comments
 (0)