Examines the propensity score (PS) distribution for potential positivity violations – regions of covariate space where the probability of receiving one treatment is near zero – and quantifies the common support region.
Usage
sa_overlap(
x,
score_col = "prob_t",
treatment_col = "tavr",
trim_threshold = 0.05,
treated_level = NULL
)Arguments
- x
A
ps_dataobject or a plain data frame.- score_col
Name of the propensity score column. Taken from
x$meta$score_colwhenxis aps_dataobject. Default"prob_t". The score of aps_match()object built withscale = "logit"is a logit, and is back-transformed withstats::plogis()before use.- treatment_col
Name of the binary treatment column (0/1). Taken from
x$meta$treatment_colwhenxis aps_dataobject. Default"tavr".- trim_threshold
Numeric in (0, 0.5). PS values below this threshold or above
1 - trim_thresholdare flagged as near-positivity violations. Default0.05.- treated_level
The value of
treatment_colthat is treated. Read from the metadata of aps_dataobject when it records one.NULL(default) requires a 0/1 or logical column and takes 1 orTRUE.
Value
An object of class c("sa_overlap", "ps_data"):
$dataThe input data frame (
x$datafor aps_dataobject), unchanged.$metascore_col,treatment_col,treated_level,scale,trim_threshold,n_total,n_score_missing,n_used(patients with a score and a treatment), andoverlap_region: a named numeric vector of thelowerandupperbounds of the empirical common support region.$tables$summaryData frame: one row per treatment group with
group(the value intreatment_col), a logicaltreated,n,ps_min,ps_q25,ps_median,ps_mean,ps_q75,ps_max.$tables$outside_overlapData frame:
group,treated,n_outside,pct_outside– patients whose PS is outside the overlap region.$tables$positivity_flagsData frame:
group,treated,n_near_zero(PS <trim_threshold),n_near_one(PS >1 - trim_threshold),pct_near_zero,pct_near_one.$modelsAn empty list.
Details
The function reports:
PS summary statistics by treatment group.
The empirical overlap region: [max(min_treated, min_control), min(max_treated, max_control)].
The proportion of each group whose PS lies outside the overlap region.
The number and proportion of patients with PS below
trim_thresholdor above1 - trim_threshold(near-positivity-violation flags).
For a ps_data input, a supplied score_col, treatment_col or
treated_level must agree with the object's metadata; a conflict aborts.
Arguments not supplied are read from the metadata.
Examples
dta <- sample_ps_data(n = 400, seed = 7)
res <- sa_overlap(dta, score_col = "prob_t", treatment_col = "tavr")
res$meta$overlap_region
#> lower upper
#> 0.0856 0.9082
res$tables$positivity_flags
#> group treated n_near_zero n_near_one pct_near_zero pct_near_one
#> 1 0 FALSE 1 0 0.2 0.0
#> 2 1 TRUE 0 2 0.0 0.5
# From a ps_match object
m <- ps_match(dta)
res <- sa_overlap(m)
res$tables$outside_overlap
#> group treated n_outside pct_outside
#> 1 0 FALSE 11 2.8
#> 2 1 TRUE 19 4.8