balance | R Documentation |
Check balance of pre-treatment variables across treatment groups
balance(data, treat = NULL, reference = NULL, ttest = F, pscore = T)
data |
A data frame that contains a dummy indicator variable for the treatment and control groups. |
treat |
A string representing the name of the indicator variable for the treatment. |
ttest |
A boolean indicating whether a t-test of the difference in means between treatment and control groups should be computed. |
pscore |
A boolean indicating whether the propensity score should be computed. **TBI** |
The statistics computed here are recommended in
Imbens, G. W., & Rubin, D. B. (2015). Causal inference in statistics, social, and biomedical sciences: An introduction. Cambridge University Press.
The function returns a list with named elements. The
element asmd
contains a table with the
Absolute Standardized Mean Difference between groups.
and control groups. The element pscore
contains
the propensity score of all observations. The element
lpscore
of the list is the logarithm of the propensity score.
data(survey)
balance(survey, treat = 'treat')
# or with a pipe
# survey %>% balance(., treat = 'treat')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.