Skip to contents

Computes the Area Under the ROC Curve (AUC) for a single weighting scheme or unweighted data. In causal inference, an AUC around 0.5 indicates good balance between treatment groups.

Usage

bal_model_auc(
  .data,
  .exposure,
  .estimate,
  .weights = NULL,
  na.rm = TRUE,
  .focal_level = NULL
)

Arguments

.data

A data frame containing the variables.

.exposure

The treatment/outcome variable (unquoted).

.estimate

The propensity score or fitted values (unquoted).

.weights

Optional single weight variable (unquoted). If NULL, computes unweighted AUC.

na.rm

A logical value indicating whether to remove missing values before computation. If FALSE (default), missing values in the input will produce NA in the output.

.focal_level

The level of the outcome variable to consider as the treatment/event. If NULL (default), uses the last level for factors or the maximum value for numeric variables.

Value

A numeric value representing the AUC. Values around 0.5 indicate good balance, while values closer to 0 or 1 indicate poor balance.

Details

The AUC provides a single metric for assessing propensity score balance. When propensity scores achieve perfect balance, the weighted distribution of scores should be identical between treatment groups, resulting in an AUC of 0.5 (chance performance).

AUC values significantly different from 0.5 indicate systematic differences in propensity score distributions between groups, suggesting inadequate balance.

See also

check_model_auc() for computing AUC across multiple weights, bal_model_roc_curve() for the full ROC curve

Other balance functions: bal_corr(), bal_ess(), bal_ks(), bal_model_roc_curve(), bal_qq(), bal_smd(), bal_vr(), check_balance(), check_ess(), check_model_auc(), check_model_roc_curve(), check_qq(), plot_balance()

Examples

# Unweighted AUC
bal_model_auc(nhefs_weights, qsmk, .fitted)
#> [1] 0.6626473

# Weighted AUC
bal_model_auc(nhefs_weights, qsmk, .fitted, w_ate)
#> [1] 0.5017247