Skip to content

Commit 25e9e11

Browse files
committed
update to calc_bal_stats to display any user-specified concurrent confounders
code was not showing concurrent confounders in balance tables
1 parent 0fc6989 commit 25e9e11

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

R/calc_bal_stats.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ calc_bal_stats <- function(data, obj, weights = NULL, balance_thresh = NULL, imp
4141
exposure <- var_tab$var[var_tab$type == "exposure"]
4242
exposure_time <- var_tab$time[var_tab$type == "exposure"]
4343
sep <- obj[["sep"]]
44+
45+
# added by IS 1/5/26 to add any specified concurrent confounders
46+
if (!is.null(var_tab$concur_conf)) { # added to fix bug if no concur_conf
47+
tv_conf_time <- tv_conf_time - 0.01 * var_tab$concur_conf[var_tab$type == "tv_conf"]
48+
}
4449

4550
# creating initial data frames
4651
# data frame with all sampling weights for all exposures at all exposure time points for all histories
@@ -58,6 +63,8 @@ calc_bal_stats <- function(data, obj, weights = NULL, balance_thresh = NULL, imp
5863
tv_conf[tv_conf_time < exposure_time_pt],
5964
exposure[exposure_time_pts < exposure_time_pt]
6065
)
66+
67+
6168

6269
var_is_factorable <- vapply(vars, function(v) {
6370
is.character(data[[v]]) || is.factor(data[[v]])

0 commit comments

Comments
 (0)