R: Compare balance graphically of a categorical covariate as...
cat.psa
R Documentation
Compare balance graphically of a categorical covariate as part of a PSA
Description
Given predefined strata and two level treatment for a categorical covariate from a propensity score analysis,
cat.psa draws pairs of side by side barplots corresponding to control and treatment for each stratum.
Vector or N X 3 dataframe or matrix. If a vector, then represents a 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 vector or factor of same length as continuous representing the two treatments.
strata
A vector or factor of same length as continuous indicating the
derived strata from estimated propensity scores. Strata are ordered lexicographically in plot.
catnames
List of names in order of the categories; used in the plot legend. Default is 1:n.
catcol
List of colors used for the categories, default is terrain.colors.
width
Controls width of bars, default = 0.25.
barlab
Binary list of single treatment character labels for the bars, default is c("A", "B"). These are defined
in a legend by barnames.
barnames
Binary list of treatment names used in the legend; by default names are taken from treatment.
rtmar
Numeric. Governs size of right margin allocated for legend. Default = 1.5
balance
Logical. If TRUE a call is made to functions bal.cs.psa and
bal.cws.psa. The former provides a reference histogram and ad hoc balance statistic,
the second provides bootstrapped p-values for the two-way table formed in each statum.
Default is FALSE.
B
Numeric; passed to bal.cs.psa governing size of reference histogram generated. Default is 100.
tbl
Logical; if TRUE, then a matrix of the proportions used in the creation of the bargraph is returned.
cex.leg
Numeric; value of cex (governing font size) passed to legend. Default = 1.
...
Other graphical parameters passed to plot.
Details
Pairs of bars are graphed side by side so that comparisons may be made within each stratum and across strata.
If balance is TRUE, then the histogram represents an ad hoc balance measure
of the given strata as compared to randomly generated strata. The p-values provided on the bargraph
are bootstrapped in a standard fashion via randomly generated treatment divisions within given strata.
For continuous covariates use box.psa.
Value
If tbl is TRUE, then a matrix is returned containing the proportions of each category, and in each treatment
level and stratum that were used to draw the bargraph.