checkBalance: Standardized Differences for Stratified Comparisons

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/checkBalance.R

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

1
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}.

Details

See help("xBalance") for details.

Value

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

Note

Evidence pertaining to the hypothesis that a treatment variable is not associated with differences in covariate values is assessed by comparing the differences of means (or regression coefficients), without standardization, to their distributions under hypothetical shuffles of the treatment variable, a permutation or randomization distribution. For the unstratified comparison, this reference distribution consists of differences (more generally, regression coefficients) when the treatment variable is permuted without regard to strata. For the stratified comparison, the reference distribution is determined by randomly permuting the treatment variable within strata, then re-calculating the treatment-control differences (regressions of each covariate on the permuted treatment variable). Significance assessments are based on the large-sample Normal approximation to these reference distributions.

Author(s)

Leo Guelman <leo.guelman@gmail.com>

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

1
2
3
4
5
6
7
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)

Example output

Loading required package: RItools
Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

Loading required package: MASS
Loading required package: coin
Loading required package: survival
Loading required package: tables
Loading required package: Hmisc
Loading required package: lattice
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, units

Loading required package: penalized
Welcome to penalized. For extended examples, see vignette("penalized").
     strata  unstrat                                                              
     stat    treat=0  treat=1 adj.diff adj.diff.null.sd std.diff     z            
vars                                                                              
X1          0.01152  -0.00596 -0.01748         0.06006  -0.01840 -0.29103         
X2          0.03160  -0.02812 -0.05972         0.06236  -0.06057 -0.95778         
X3          0.01145  -0.02242 -0.03387         0.06355  -0.03370 -0.53303         
X4          0.01533  -0.03551 -0.05083         0.06370  -0.05046 -0.79801         
X5          -0.06440 0.02370  0.08810          0.06153  0.09060  1.43175          
X6          0.02237  -0.02177 -0.04414         0.06308  -0.04425 -0.69980         
---Overall Test---
        chisquare df p.value
unstrat      4.54  6   0.604
---
Signif. codes:  0 '***' 0.001 '** ' 0.01 '*  ' 0.05 '.  ' 0.1 '   ' 1 

uplift documentation built on May 2, 2019, 9:32 a.m.