bal.cs.psa: Balance for Categorical Covariate: Random Strata as part of a...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/bal.cs.psa.R

Description

Function provides a measure of the balance achieved between control and treatment groups for a categorical covariate from user defined strata. This statistic is compared to the same measure for randomly permuted strata.

Usage

1
2
bal.cs.psa(categorical, treatment = NULL, strata = NULL, B = 1000, 
    eps =.02, main = NULL, ...)

Arguments

categorical

Categorical covariate that is being balanced within strata in a PSA. If categorical has three columns, then the second and third are assumed to be the treatment and strata respectively. Missing values are not allowed. May be factor or numeric.

treatment

Binary variable of same length as categorical; generally 0 for 'control,' 1 for 'treatment.'

strata

Integer variable; a vector of same length as categorical indicating the derived strata from estimated propensity scores.

B

Numeric; number of randomly generated iterations of the balance measure are created for the comparison distribution.

eps

Numeric; ensures that weighting is reasonable for small categories.

main

Title passed to histogram.

...

Other graphical parameters passed to histogram.

Details

This function measures the balance achieved across K strata for a categorical covariate with J categories. If p_{ijk} is the proportion of cases in stratum k, category j, and treatment i, then the statistic is the sum over all K, J of |√{p_{0jk} + ε} - √{p_{1jk} + ε } | . A permutation distribution is generated by randomly assigning cases to strata, thus generating B permuted stratifications and the associated B permutation statistics. The permutation stratifications are generated under a fixed marginals model to retain comparability with the original stratification. A histogram of the permutation statistics is produced with the original statistic referenced as a red dot.

Value

In addition to the histogram, a list with the following components is returned:

balance.orig

Balance measure of user defined strata.

rank.orig

Rank of original balance measure in comparison with the B randomly generated values.

Author(s)

James E. Helmreich James.Helmreich@Marist.edu

Robert M. Pruzek RMPruzek@yahoo.com

See Also

bal.cws.psa, bal.ms.psa, bal.ks.psa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#Everything random
categorical<-sample(4,1000,replace=TRUE)
treatment<-sample(c(0,1),1000,replace=TRUE)
strata<-sample(5,1000,replace=TRUE)
bal.cs.psa(categorical,treatment,strata)

#Perfect balance on 80%, random on last 20%
categorical<-rep(sample(5,1000,replace=TRUE),2)
treatment<-c(rep(0,1000),rep(1,1000))
strat<-sample(6,1200,replace=TRUE)
strat<-c(strat[1:1000],strat[1:800],strat[1001:1200])
bal.cs.psa(categorical,treatment,strat,B=200)

PSAgraphics documentation built on May 2, 2019, 2:42 a.m.