loess.psa {PSAgraphics}R Documentation

Graphical and loess based estimate of effect size using propensity scores

Description

Draws propesity vs. response for both treatment groups, and plots loess based curves through these groups. The loess curves are used to derive an estimate of effect size. Motivated by a suggestion of R. L. Obenchain.

Usage

loess.psa(response, treatment = NULL, propensity = NULL, 
family = "gaussian", 
span = 0.7, degree = 1, minsize = 5, xlim = c(0, 1), 
colors = c("seagreen3", "goldenrod1", "seagreen4", "goldenrod3"), 
legend.xy = "topleft", legend = c("C", "T"),
int = 15, lines = FALSE, rg = TRUE, xlab = "Estimated Propensity Scores", 
ylab = "Response", pch = c(16,1), ...)

Arguments

response Either a numeric vector containing the response of interest in a propensity score analysis, or a three column array containing response, treatment and strata.
treatment Binary variable of same length as response; 0 for 'control,' 1 for 'treatment.'
propensity Numeric vector of estimated propensity scores.
family Passed to loess. Either "gaussian" (default) or "symmetric".
span Parameter passed to loess governing degree of smoothing. Default = 0.7.
degree Parameter passed to loess governing degree of polynomials used. Default = 1
minsize Integer. Determines the minimum number of observations in each stratum treatment group allowed. If one of the treatment groups in a given statum does not meet this minsize, then all observations in this stratum are ignored as far as the effect size calculation is concerned.
xlim Binary vector (min, max) providing the horizontal axis minimum and maximum. Default is c(0, 1).
colors List of four colors used for control points, treatment points, control loess line, treatment loess line respectively. Default =
c("seagreen3", "goldenrod1", "seagreen4", "goldenrod3").
legend.xy Coordinates for legend box, see legend. Default = "topleft".
legend Text of legend. Default = c("C", "T") assumes 0 in treatment is control, 1 is treatment.
int Integer or ordered vector. If an integer is used, it represents the maximum number of equally sized strata. Alternatively, it may be a vector of cuts of the unit interval. Lower and upper ends need not be included. See examples. Default = 15.
lines Logical; fitted loess values are plotted by default as points. If true, values are plotted as two lines.
rg Logical; if TRUE (default) then rug plots are given for treatment and control propensity score and response distributions.
xlab X axis label, default = "Estimated Propensity Scores".
ylab Y axis label, default = "Response".
pch Character types for plotted points, default = c(16, 1). Note: must be of length 2 to allow different plotting points for each treatment.
... Optional parameters passed to points command.

Value

In addition to the plot, the function returns a list with the following components:

effect.size.est Estimated effect size based upon the strata defined by int.
sd.wtd Weighted standard deviation of strata effect size estimates.
summary.strata A table with rows corresponding to strata, and columns providing the counts (by statum) in both treatments, and means of the response, as well as the difference in each strata of the treatment means. It is the weighted average difference that forms the effect size above.

Author(s)

James E. Helmreich James.Helmreich@Marist.edu

Robert M. Pruzek RMPruzek@yahoo.com

See Also

circ.psa

Examples

#Artificial example where dee should be 1.5 over all of (0,1).
#Over the 4 subintervals provided should be 1.5 as well as is 
#symmetric about .5
response <- c(rep(1,150), rep(2,150), rep(0,300))
treatment <- c(rep(1,300), rep(0,300))
propensity <- rep(seq(.01, .99, (.98/299)), 2)
a <- data.frame(response, treatment, propensity)
loess.psa(a, span = .15, degree = 1, int = c(.1, .3, .5, .7, .9))

#Artificial example where estimates are unstable with varying 
#numbers of strata. Note: sometimes get empty treatment/strata error.
rr <- c(rnorm(150, 3, .75), rnorm(700, 0, .75), rnorm(150, 3, .75), 
     rnorm(150, -3, .75), rnorm(700, 0, .75), rnorm(150, -3, .75))
tt <- c(rep(1, 1000),rep(0, 1000))
pp <- NULL
for(i in 1:1000){pp <- c(pp, rnorm(1, 0, .05) + .00045*i + .25)}
for(i in 1:1000){pp <- c(pp, rnorm(1, 0, .05) + .00045*i + .4)}
a <- data.frame(rr, tt, pp)
loess.psa(a, span=.5, cex = .6)

#Using strata of possible interest as determined by loess lines.
data(lindner)
attach(lindner)
lindner.ps <- glm(abcix ~ stent + height + female + 
      diabetic + acutemi + ejecfrac + ves1proc, 
      data = lindner, family = binomial)
loess.psa(log(cardbill), abcix, lindner.ps$fitted,  
         int = c(.37, .56, .87, 1), lines = TRUE)
         abline(v=.37)
         abline(v=.56)
         abline(v=.87)

[Package PSAgraphics version 1.0 Index]