Plots the propensity (or preference) score distribution.
plotPs( data, unfilteredData = NULL, scale = "preference", type = "density", binWidth = 0.05, targetLabel = "Target", comparatorLabel = "Comparator", showCountsLabel = FALSE, showAucLabel = FALSE, showEquiposeLabel = FALSE, equipoiseBounds = c(0.3, 0.7), unitOfAnalysis = "subjects", title = NULL, fileName = NULL )
A data frame with at least the two columns described below
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
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).
Type of plot. Four possible values:
type = 'density'
type = 'histogram',
type = 'histogramCount',
type = 'histogramProportion'.
'histogram' defaults to
For histograms, the width of the bins
A label to us for the target cohort.
A label to us for the comparator cohort.
Show subject counts?
Show the AUC?
Show the percentage of the population in equipoise?
The bounds on the preference score to determine whether a subject is in equipoise.
The unit of analysis in the input data. Defaults to 'subjects'.
Optional: the main title for the plot.
Name of the file where the plot should be saved, for example 'plot.png'.
See the function
ggplot2::ggsave() for supported file formats.
A ggplot object. Use the
ggplot2::ggsave() function to save to file in a different
The data frame should have a least the following two columns:
treatment (integer): Column indicating whether the person is in the target (1) or comparator (0) group
propensityScore (numeric): Propensity score
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