PS weighting for survival outcomes (PSsurvival)
Follow the analysis.
Select a node to explore the method
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)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
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"
)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
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)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Inputs & data
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 |
Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.
The estimate
\Delta S(t)=S_1(t)-S_0(t),\quad \hat S_z(t)=\prod_{t_k\le t}!\Big(1-\frac{\sum_i w_i\,dN_i(t_k)}{\sum_i w_i\,Y_i(t_k)}\Big)
⚠️ 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
Discuss the workflow (0)
Log in to join the discussion.