loess.plot: Loess plot with density distributions for propensity scores...

Description Usage Arguments Value See Also Examples

Description

Loess plot with density distributions for propensity scores and outcomes on top and right, respectively.

Usage

1
2
3
4
loess.plot(x, response, treatment, responseTitle = "",
  treatmentTitle = "Treatment", percentPoints.treat = 0.1,
  percentPoints.control = 0.01, points.treat.alpha = 0.1,
  points.control.alpha = 0.1, plot.strata, plot.strata.alpha = 0.2, ...)

Arguments

x

vector of propensity scores.

response

the response variable.

treatment

the treatment variable as a logical type.

responseTitle

the label to use for the y-axis (i.e. the name of the response variable)

treatmentTitle

the label to use for the treatment legend.

percentPoints.treat

the percentage of treatment points to randomly plot.

percentPoints.control

the percentage of control points to randomly plot.

points.treat.alpha

the transparency level for treatment points.

points.control.alpha

the transparency level for control points.

plot.strata

an integer value greater than 2 indicating the number of vertical lines to plot corresponding to quantiles.

plot.strata.alpha

the alpha level for the vertical lines.

...

other parameters passed to geom_smooth and stat_smooth.

Value

a ggplot2 figure

See Also

plot.mlpsa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
require(multilevelPSA)
require(party)
data(pisana)
data(pisa.psa.cols)
cnt = 'USA' #Can change this to USA, MEX, or CAN
pisana2 = pisana[pisana$CNT == cnt,]
pisana2$treat <- as.integer(pisana2$PUBPRIV) %% 2
lr.results <- glm(treat ~ ., data=pisana2[,c('treat',pisa.psa.cols)], family='binomial')
st = data.frame(ps=fitted(lr.results), 
				math=apply(pisana2[,paste('PV', 1:5, 'MATH', sep='')], 1, mean), 
				pubpriv=pisana2$treat)
				st$treat = as.logical(st$pubpriv)
loess.plot(st$ps, response=st$math, treatment=st$treat, percentPoints.control = 0.4, 
           percentPoints.treat=0.4)

## End(Not run)

Example output

Loading required package: ggplot2
Loading required package: xtable
Loading required package: party
Loading required package: grid
Loading required package: mvtnorm
Loading required package: modeltools
Loading required package: stats4
Loading required package: strucchange
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: sandwich
Warning message:
glm.fit: fitted probabilities numerically 0 or 1 occurred 
`geom_smooth()` using method = 'gam'
Warning message:
`panel.margin` is deprecated. Please use `panel.spacing` property instead 

multilevelPSA documentation built on May 1, 2019, 9:19 p.m.