preparePsPlot | R Documentation |
Prepare to plot the propensity (or preference) score distribution. It computes the distribution, so the output does not contain person-level data.
preparePsPlot(data, unfilteredData = NULL, scale = "preference")
data |
A data frame with at least the two columns described below |
unfilteredData |
To be used when computing preference scores on data from which subjects have
already been removed, e.g. through trimming and/or matching. This data frame
should have the same structure as |
scale |
The scale of the graph. Two scales are supported: |
The data frame should have a least the following two columns:
treatment (integer): Column indicating whether the person is in the treated (1) or comparator (0) group. - propensityScore (numeric): Propensity score.
A data frame describing the propensity score (or preference score) distribution at 100 equally-spaced points.
Walker AM, Patrick AR, Lauer MS, Hornbrook MC, Marin MG, Platt R, Roger VL, Stang P, and Schneeweiss S. (2013) A tool for assessing the feasibility of comparative effectiveness research, Comparative Effective Research, 3, 11-20
plotPreparedPs
# Simulate some data for this example:
treatment <- rep(0:1, each = 100)
propensityScore <- c(rnorm(100, mean = 0.4, sd = 0.25), rnorm(100, mean = 0.6, sd = 0.25))
data <- data.frame(treatment = treatment, propensityScore = propensityScore)
data <- data[data$propensityScore > 0 & data$propensityScore < 1, ]
preparedPlot <- preparePsPlot(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.