spsurv: An R package for semi-parametric survival analysis.
The spsurv package was designed to contribute with a flexible set of semi-parametric survival regression options, including proportional hazards (PH), proportional odds (PO), and accelerated failure time (AFT) models for right-censored data.
The package provides:
- Survival classes (PH, PO, AFT) extensions based on a fully likelihood-based approach for either Bayesian or maximum likelihood (ML) estimation procedures
- Smooth estimates for the unknown baseline functions based on the Bernstein polynomial (BP)
- Integration with Stan for user-defined modeling
- Six distinct prior specification options in a Bayesian analysis
Stan is an open-source platform with its own language and log-probability functions for custom likelihoods and priors. Access to Stan in R is provided via rstan; the package uses NUTS (No-U-Turn) sampling by default for Bayesian fits.
install.packages("spsurv")install.packages("devtools")
devtools::install_github("rvpanaro/spsurv")Fit a BP-based survival regression PH model:
library("KMsurv")
data("larynx")
library(spsurv)
fit <- bpph(Surv(time, delta) ~ age + factor(stage), model = "ph", data = larynx)
summary(fit)Alternatively, use the spbp function:
fit <- spbp(Surv(time, delta) ~ age + factor(stage), model = "ph", data = larynx)
summary(fit)Bayesian analysis with the approach argument:
fit2 <- spbp(Surv(time, delta) ~ age + factor(stage),
approach = "bayes", data = larynx,
iter = 2000, chains = 1, warmup = 1000)
summary(fit2)See the reference manual for more examples.
Please report issues at https://github.com/rvpanaro/spsurv/issues or contact the maintainer (see DESCRIPTION).
GPL-3
