
Plot propensity (or censoring) score overlap by group
propensityplot.RdProduces a diagnostic overlap plot for a set of propensity-like scores (e.g., treatment propensity
scores or censoring propensities) stratified by a binary group indicator A. The function
visualizes the empirical score distributions using semi-transparent histograms on a density scale.
This plot is primarily intended to assess common support / overlap and to diagnose separation or extreme predicted probabilities before matching/weighting steps.
Details
The input A is coerced to a factor and used for coloring and filling the histogram.
The y-axis is scaled to density (..density..). The function returns a ggplot2 object
(invisibly) and also prints the plot as a side effect, which is convenient in interactive use.
Package note. In a package context, avoid library(ggplot2) inside functions.
Instead, use ggplot2:: calls and guard availability via requireNamespace("ggplot2", quietly = TRUE).