From 53c849807bc6a5eefd3b1407811b6fea78b8ed20 Mon Sep 17 00:00:00 2001 From: naeemkh Date: Mon, 4 Mar 2024 19:21:54 -0500 Subject: [PATCH] fix covariate balance type --- R/check_covar_balance.R | 6 ------ R/generate_pseudo_pop.R | 14 +++++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/R/check_covar_balance.R b/R/check_covar_balance.R index 9db1dc9f..e6acbf48 100644 --- a/R/check_covar_balance.R +++ b/R/check_covar_balance.R @@ -113,12 +113,6 @@ check_covar_balance <- function(w, post_process_abs <- function(abs_cor) { covar_bl_t <- paste0(covar_bl_trs_type, "_absolute_corr") - logger::log_debug(paste0(covar_bl_trs_type, - " absolute correlation: ", - getElement(abs_cor, covar_bl_t))) - message(paste0(covar_bl_trs_type, " absolute correlation: ", - getElement(abs_cor, covar_bl_t), - "| Covariate balance threshold: ", covar_bl_trs)) output <- list(corr_results = abs_cor) diff --git a/R/generate_pseudo_pop.R b/R/generate_pseudo_pop.R index eef86855..2fa71cef 100755 --- a/R/generate_pseudo_pop.R +++ b/R/generate_pseudo_pop.R @@ -120,6 +120,11 @@ generate_pseudo_pop <- function(.data, covar_bl_trs = covar_bl_trs, covar_bl_trs_type = covar_bl_trs_type) + covar_bl_t <- paste0(covar_bl_trs_type, "_absolute_corr") + message(paste0(covar_bl_trs_type, " absolute correlation (original): ", + getElement(original_corr_obj$corr_results, covar_bl_t), + "| Covariate balance threshold: ", covar_bl_trs)) + # Check covariate balance for weighted/matched data, and trimmed if any adjusted_corr_obj <- check_covar_balance( w = merged_data[, c(exposure_col)], @@ -130,6 +135,10 @@ generate_pseudo_pop <- function(.data, covar_bl_trs = covar_bl_trs, covar_bl_trs_type = covar_bl_trs_type) + message(paste0(covar_bl_trs_type, " absolute correlation (adjusted): ", + getElement(adjusted_corr_obj$corr_results, covar_bl_t), + "| Covariate balance threshold: ", covar_bl_trs)) + # check Kolmogorov-Smirnov statistics ks_stats <- check_kolmogorov_smirnov(w = merged_data[, c(exposure_col)], c = merged_data[, covariate_cols], @@ -181,11 +190,6 @@ generate_pseudo_pop <- function(.data, end_time_gpp <- proc.time() - # logger::log_debug("Wall clock time to run generate_pseudo_pop:", - # " {(end_time_gpp - st_time_gpp)[[3]]} seconds.") - # logger::log_debug("Covariate balance condition has been met (TRUE/FALSE):", - # " {adjusted_corr_obj$pass}, (iteration:", - # " {counter} / {max_attempt})") invisible(result) }