Skip to content

Commit c27b3b5

Browse files
committed
Update calc_bal_stats.R
linking omitted histories in calc_bal_stats
1 parent 2c16145 commit c27b3b5

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

R/calc_bal_stats.R

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,15 @@ calc_bal_stats <- function(data, obj, weights = NULL, balance_thresh = NULL, imp
124124
} # ends hist exc
125125

126126
# added by IS 4/8/26 to skip histories for which exposures are all 0s or all 1s (cannot calc bal stats)
127-
omitted_histories <- Filter(
128-
function(h) {
129-
which_idx <- (history == h)
130-
vals <- data[[exposure_name]][which_idx]
131-
all(vals == 0) || all(vals == 1)
132-
},
133-
setdiff(prop_sum$history, omitted_histories)
134-
)
127+
omitted_histories <- c(omitted_histories,
128+
Filter(
129+
function(h) {
130+
which_idx <- (history == h)
131+
vals <- data[[exposure_name]][which_idx]
132+
all(vals == 0) || all(vals == 1)
133+
},
134+
setdiff(prop_sum$history, omitted_histories)
135+
))
135136

136137
# finding balance by history
137138
# if weighted, use IPTW weights from weightitmsm and weight by history

0 commit comments

Comments
 (0)