MyNixOS website logo
Description

Propensity Score Methods for Survival Analysis.

Implements propensity score weighting methods for estimating counterfactual survival functions, marginal hazard ratios, and weighted Kaplan-Meier and cumulative risk curves in observational studies with time-to-event outcomes. Supports binary and multiple treatment groups with inverse probability of treatment weighting (IPW), overlap weighting (OW), and average treatment effect on the treated (ATT). Includes symmetric trimming (Crump extension) for extreme propensity scores. Variance estimation via analytical M-estimation or bootstrap. Methods based on Li et al. (2018) <doi:10.1080/01621459.2016.1260466>, Li & Li (2019) <doi:10.1214/19-AOAS1282>, and Cheng et al. (2022) <doi:10.1093/aje/kwac043>.

PSsurvival

R-CMD-check

Propensity score methods for survival analysis.

Overview

PSsurvival implements propensity score methods for observational studies with time-to-event outcomes. The package provides three main functions:

Counterfactual survival functions (surveff): Estimates group-specific survival curves and survival differences over time, adjusting for confounding via propensity score weighting and for censoring via inverse probability of censoring weighting.

Marginal hazard ratios (marCoxph): Fits weighted marginal Cox proportional hazards models to estimate marginal hazard ratios between treatment groups.

Weighted Kaplan-Meier curves (weightedKM): Estimates weighted Kaplan-Meier (KM) and cumulative risk (CR) curves with propensity score weights.

All functions support:

  • Binary and multiple (>2) treatment groups
  • Weighting schemes: inverse probability weighting (IPW), overlap weighting (OW), and average treatment effect on the treated (ATT)
  • Propensity score trimming: symmetric trimming (Crump extension for multiple treatments)
  • Variance estimation: analytical M-estimation (binary treatment with Weibull censoring) or bootstrap

Installation

# Install from GitHub (requires devtools)
devtools::install_github("cxinyang/PSsurvival")

# Install from R CRAN
install.package("PSsurvival")

Usage

library(PSsurvival)

# Counterfactual survival curves with overlap weighting
result <- surveff(
  data = mydata,
  ps_formula = treatment ~ X1 + X2 + X3,
  censoring_formula = Surv(time, event) ~ X1 + X2,
  weight_method = "OW",
  censoring_method = "weibull"
)

summary(result)
plot(result)

# Marginal hazard ratio with IPW
hr_result <- marCoxph(
  data = mydata,
  ps_formula = treatment ~ X1 + X2 + X3,
  time_var = "time",
  event_var = "event",
  reference_level = "control",
  weight_method = "IPW"
)

summary(hr_result)

# Weighted Kaplan-Meier with risk table
km_result <- weightedKM(
  data = mydata,
  treatment_var = "treatment",
  ps_formula = treatment ~ X1 + X2 + X3,
  time_var = "time",
  event_var = "event",
  weight_method = "OW"
)

plot(km_result, risk_table = TRUE)
summary(km_result)

Details

Propensity score estimation: Uses logistic regression for binary treatments and multinomial logistic regression (via nnet::multinom) for multiple treatments.

Censoring adjustment (surveff only): Models the censoring distribution within each treatment group using either Weibull accelerated failure time models or Cox proportional hazards models.

Variance estimation: For binary treatments with Weibull censoring, analytical variance based on M-estimation theory is available. Bootstrap variance (resampling the full estimation pipeline) is supported for all configurations.

References

Li, F., Morgan, K. L., & Zaslavsky, A. M. (2018). Balancing covariates via propensity score weighting. Journal of the American Statistical Association, 113(521), 390-400.

Li, F., & Li, F. (2019). Propensity score weighting for causal inference with multiple treatments. The Annals of Applied Statistics, 13(4), 2389-2415.

Cheng, C., Li, F., Thomas, L. E., & Li, F. (2022). Addressing extreme propensity scores in estimating counterfactual survival functions via the overlap weights. American Journal of Epidemiology, 191(6), 1140-1151.

Metadata

Version

0.2.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows