Description Usage Arguments Details Value Author(s) See Also Examples
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.
1 2  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

treatment 
Binary variable of same length as 
strata 
Integer variable; a vector of same length as 
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 
... 
Other graphical parameters passed to 
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.
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
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)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.