Calculate standardized differences in means between treated and control groups,
before and after refining the control group. Used within the check_balance function.
get_stand_diffs(
data,
z,
selected,
st = NULL,
ist = NULL,
treated = 1,
control = 0,
denom_variance = "treated"
)data frame containing two columns, one for standardized differences before choosing a subset of controls, and one for after. The rows pertain to covariates.
A data frame with columns for which the standardized differences should be calculated.
a factor with the ith entry equal to the treatment of unit i.
a boolean vector including whether each unit was selected as part of the treated and control
groups for analysis. Should be the same length as z and typically comes from the results of
optimize_controls().
a stratum vector with the ith entry equal to the
stratum of unit i. This should have the same order of units and length
as z.
The specific stratum for which the standardized differences should be calculated.
which treatment value should be considered the treated units. This
must be one of the values of z.
which treatment value should be considered the control units. This
must be one of the values of z.
character stating what variance to use in the standardization:
either the default "treated", meaning the standardization will use the
treated variance (across all strata), where the treated group is declared in
the treated argument, or "pooled", meaning
the standardization will use the average of the variances of each treatment group.