box.psa {PSAgraphics} | R Documentation |
Compare balance graphically of a continuous covariate as part of a PSA
Description
Given predefined strata and two level treatment for a continuous covariate
from a propensity score analysis, box.psa
draws pairs of side by side
boxplots corresponding to control and treatment for each stratum.
Usage
box.psa(
continuous,
treatment = NULL,
strata = NULL,
boxwex = 0.17,
offset = 0.17,
col = c("yellow", "orange", "black", "red", "darkorange3"),
xlab = "Stratum",
legend.xy = NULL,
legend.labels = NULL,
pts = TRUE,
balance = FALSE,
trim = 0,
B = 1000,
...
)
Arguments
continuous |
Vector or N X 3 dataframe or matrix. If a vector, then
represents the quantitative covariate that is being balanced within strata
in a PSA. If |
treatment |
Binary vector of same length as |
strata |
A vector or factor of same length as |
boxwex |
Numeric; controls width of boxes. Default = 0.17 |
offset |
Numeric; controls distance between the two boxes in each stratum. Default = 0.17 |
col |
Default = |
xlab |
Label for the x-axis; default = |
legend.xy |
Binary vector giving coordinates of the legend. By default the legend is placed to the top left. |
legend.labels |
Vector of labels for the legend; default is essentially
|
pts |
Logical; if |
balance |
Logical; if |
trim |
If |
B |
Passed to |
... |
Other graphical parameters passed to |
Details
Draws a pair of side by side boxplots for each stratum of a propensity score analysis. This allows visual comparisons within strata of the distribution of the given continuous covariate, and comparisons between strata as well. The number of observations in each boxplot are given below each box, and the means of paired treatment and control groups are connected.
Author(s)
James E. Helmreich James.Helmreich@Marist.edu
Robert M. Pruzek RMPruzek@yahoo.com
See Also
bal.ks.psa
, bal.ms.psa
, cat.psa
Examples
continuous<-rnorm(1000)
treatment<-sample(c(0,1),1000,replace=TRUE)
strata<-sample(5,1000,replace=TRUE)
box.psa(continuous, treatment, strata)
data(lindner)
attach(lindner)
lindner.ps <- glm(abcix ~ stent + height + female +
diabetic + acutemi + ejecfrac + ves1proc,
data = lindner, family = binomial)
ps<-lindner.ps$fitted
lindner.s5 <- as.numeric(cut(ps, quantile(ps, seq(0, 1, 1/5)),
include.lowest = TRUE, labels = FALSE))
box.psa(ejecfrac, abcix, lindner.s5, xlab = "ejecfrac",
legend.xy = c(3.5,110))
lindner.s10 <- as.numeric(cut(ps, quantile(ps, seq(0, 1, 1/5)),
include.lowest = TRUE, labels = FALSE))
box.psa(height, abcix, lindner.s10, xlab="height",
boxwex = .15, offset = .15, legend.xy = c(2,130), balance = TRUE)