bal.cs.psa {PSAgraphics} | R Documentation |
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.
bal.cs.psa(categorical, treatment = NULL, strata = NULL, B = 1000, eps =.02, main = NULL, ...)
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 . |
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 |sqrt{p_{0jk} + ε} - sqrt{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.
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. |
James E. Helmreich James.Helmreich@Marist.edu
Robert M. Pruzek RMPruzek@yahoo.com
bal.cws.psa
, bal.ms.psa
, bal.ks.psa
#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 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)