Learn R Programming

uplift (version 0.3.5)

checkBalance: Standardized Differences for Stratified Comparisons

Description

This function is simply a wrapper for xBalance{RItools}. Given covariates, a treatment variable, and (optionally) a stratifying factor, it calculates standardized mean differences along each covariate, and tests for conditional independence of the treatment variable and the covariates.

Usage

checkBalance(formula, data, report = "all", ...)

Arguments

formula
A formula containing an indicator of treatment assignment on the left hand side and covariates at right.
data
A data frame in which the formula and (optionally) strata are to be evaluated.
report
Character vector listing measures to report for each stratification; a subset of c("adj.means","adj.mean.diffs", "adj.mean.diffs.null.sd", "chisquare.test", "std.diffs","z.scores","p.values","all"). P-values reported are two-sided for the null-hypothesis of no effect. The option "all" requests all measures.
...
Additional arguments passed to xBalance{RItools}.

Value

An object of class c("xbal", "list"). There are plot, print, and xtable methods for class xbal.

Details

See help("xBalance") for details.

References

Hansen, B.B. and Bowers, J. (2008). Covariate Balance in Simple, Stratified and Clustered Comparative Studies. Statistical Science 23.

Kalton, G. (1968). Standardization: A technique to control for extraneous variables. Applied Statistics 17, 118-136.

Examples

Run this code
library(uplift)

set.seed(12345)
dd <- sim_pte(n = 1000, p = 20, rho = 0, sigma =  sqrt(2), beta.den = 4)
dd$treat <- ifelse(dd$treat == 1, 1, 0) 

checkBalance(treat ~ X1 + X2 + X3 + X4 + X5 + X6 , data = dd)

Run the code above in your browser using DataLab