Propensity-score balancing weights for time-to-event outcomes: counterfactual survival curves, survival differences, and marginal hazard ratios.
Input · what goes in
One row per unit: covariates X, treatment Z, follow-up time, and an event/censoring indicator.
Show data format & exampleHide example
| Z | X1 | B1 | time | event |
|---|---|---|---|---|
| A | 0.31 | 1 | 12.4 | 1 |
| B | -0.8 | 0 | 20.0 | 0 |
| A | 1.05 | 1 | 6.7 | 1 |
| B | -0.2 | 0 | 15.3 | 0 |
Pipeline · the recipe
↑ Click any step in the diagram to read its logic, code, assumptions & discussion.
Load package and survival data
Data preparation — shapes the raw inputs into what the estimator expects.
Load simdata_bin, which holds a binary treatment Z, covariates, and right-censored (time, event) outcomes for two arms A and B.
# Install: install.packages("PSsurvival")
library(PSsurvival)
data(simdata_bin)
head(simdata_bin)
table(simdata_bin$Z)
- No comments on this step yet — be the first.
Log in to comment on this step.
Run surveff() with overlap weights
The core estimate — where the causal quantity itself is computed.
surveff fits the propensity model and a Weibull censoring model, forms overlap weights, and produces inverse-probability-of-censoring-weighted survival curves per arm.
result_bin <- surveff(
data = simdata_bin,
ps_formula = Z ~ X1 + X2 + X3 + B1 + B2,
censoring_formula = survival::Surv(time, event) ~ X1 + B1,
weight_method = "OW",
censoring_method = "weibull"
)
- No comments on this step yet — be the first.
Log in to comment on this step.
Survival difference with confidence intervals
Uncertainty quantification — standard errors, intervals, and aggregation.
summary() reports the weighted KM survival functions for A and B and their difference B − A at each evaluation time, with analytical SEs and 95% Wald intervals.
summary(result_bin, conf_level = 0.95, max.len = 5)
- No comments on this step yet — be the first.
Log in to comment on this step.
Output · what you get
Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.
Result · the numbers
⚠️ Unofficial community showcase of PSsurvival (docs). Not affiliated with the authors — all credit to Fan Li & coauthors; this summarizes public documentation.
What it does. PSsurvival extends propensity-score weighting to censored time-to-event data, estimating counterfactual survival functions, survival differences, and marginal hazard ratios under binary or multiple treatments.
How it works. It combines propensity-score balancing weights (IPW, overlap/ATO, ATT, with optional symmetric trimming) with inverse-probability-of-censoring weights to handle dependent censoring. surveff() returns weighted counterfactual survival probabilities and their differences; marCoxph() fits a weighted Cox model for a marginal hazard ratio; weightedKM() produces weighted Kaplan-Meier and cumulative-incidence curves. The censoring model can be Weibull or Cox, and variances come from analytic sandwich formulas or the bootstrap. Overlap weights smoothly down-weight extreme propensity scores, reducing the variance inflation that plagues IPW survival estimators (Cheng, Li, Thomas & Li, AJE 2022).
Assumptions. Unconfoundedness, positivity (relaxed under OW), correctly specified PS and censoring models, and non-informative censoring conditional on covariates.
What you get — Weighted counterfactual survival curves and survival-difference estimates, a marginal hazard ratio, with analytic or bootstrap SEs/CIs.
Example output
Treatment groups: A, B
Number of groups: 2
Estimand: overlap
Censoring method: weibull
Variance method: analytical
Evaluation times: 666 time points
Survival function estimates:
A B
[1,] 0.9979 1.0000
[2,] 0.9960 1.0000
[3,] 0.9960 0.9973
Treatment effect estimates:
B vs A
[1,] 0.0021
[2,] 0.0040
[3,] 0.0013

Discussion (0)
Log in to join the discussion.