Plot the propensity score distribution
plotPreparedPs( preparedPsPlots, labels, treatmentLabel = "Target", comparatorLabel = "Comparator", fileName = NULL )
list of prepared propensity score data as created by the
A vector containing the labels for the various sources.
A label to us for the treated cohort.
A label to us for the comparator cohort.
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 format.
# 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) # Just reusing the same data three times for demonstration purposes: preparedPsPlots <- list(preparedPlot, preparedPlot, preparedPlot) labels <- c("Data site A", "Data site B", "Data site C") plotPreparedPs(preparedPsPlots, labels)