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")

Arguments

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 data.

scale

The scale of the graph. Two scales are supported: scale = 'propensity' or scale = 'preference'. The preference score scale is defined by Walker et al. (2013).

Value

A data frame describing the propensity score (or preference score) distribution at 100 equally-spaced points.

Details

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.

References

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

See also

Examples

# 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)