plotPreparedPs: Plot the propensity score distribution

Description Usage Arguments Value See Also Examples

View source: R/CohortMethod.R

Description

Plot the propensity score distribution

Usage

1
2
3
4
5
6
7
plotPreparedPs(
  preparedPsPlots,
  labels,
  treatmentLabel = "Target",
  comparatorLabel = "Comparator",
  fileName = NULL
)

Arguments

preparedPsPlots

list of prepared propensity score data as created by the preparePsPlot() function.

labels

A vector containing the labels for the various sources.

treatmentLabel

A label to us for the treated cohort.

comparatorLabel

A label to us for the comparator cohort.

fileName

Name of the file where the plot should be saved, for example 'plot.png'. See the function ggplot2::ggsave for supported file formats.

Value

A ggplot object. Use the ggplot2::ggsave function to save to file in a different format.

See Also

preparePsPlot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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)

OHDSI/EvidenceSynthesis documentation built on Feb. 14, 2021, 9:15 p.m.