spsurv provides flexible semi-parametric survival regression for right-censored data: proportional hazards (PH), proportional odds (PO), and accelerated failure time (AFT) models with smooth baseline functions estimated via Bernstein polynomials.
- PH / PO / AFT regression with Bernstein polynomial baseline functions
- Estimation via maximum likelihood or Bayesian inference
- Bayesian fitting via Stan (NUTS/HMC), with multiple prior options
- Extensible interface for user-defined modeling workflows
- Install the CRAN version:
install.packages("spsurv")- Installation using the devtools package:
install.packages("remotes")
remotes::install_github("rvpanaro/spsurv")library(survival)
library(KMsurv)
library(spsurv)
data("larynx") # time = follow-up time, delta = event indicator
fit <- spbp(Surv(time, delta) ~ age + factor(stage), model = "ph", data = larynx)
summary(fit) set.seed(1)
fit_bayes <- spbp(
Surv(time, delta) ~ age + factor(stage),
model = "ph",
approach = "bayes",
data = larynx,
iter = 2000,
warmup = 1000,
chains = 4
)
summary(fit_bayes)More examples: https://rvpanaro.github.io/spsurv/reference/index.html
citation("spsurv")
- Bug reports and feature requests: https://github.com/rvpanaro/spsurv/issues
- Questions: open a GitHub Discussion (if enabled) or file an issue with a reproducible example
- Contact: rvpanaro@gmail.com{.email}
