get_stand_diffs: Calculate standardized differences

Description Usage Arguments Value

View source: R/check_balance.R

Description

Calculate standardized differences in means between treated and control groups, before and after refining the control group. Used within the check_balance function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
get_stand_diffs(
  data,
  z,
  selected,
  st = NULL,
  ist = NULL,
  treated = 1,
  control = 0,
  denom_variance = "treated"
)

Arguments

data

A data frame with columns for which the standardized differences should be calculated.

z

a factor with the ith entry equal to the treatment of unit i.

selected

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().

st

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.

ist

The specific stratum for which the standardized differences should be calculated.

treated

which treatment value should be considered the treated units. This must be one of the values of z.

control

which treatment value should be considered the control units. This must be one of the values of z.

denom_variance

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.

Value

data frame containing two columns, one for standardized differences before choosing a subset of controls, and one for after. The rows pertain to covariates.


natstrat documentation built on Oct. 15, 2021, 5:12 p.m.