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 proposed 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 software aiming more flexibility in terms of user-defined modeling,
-
six distinct prior specification options in a Bayesian analysis.
Stan is an open-source platform that has a specific language and many built-in log-probability functions that can be used to define custom likelihood functions and prior specifications. The program has extensive supporting literature available online such as reference manuals, forums, articles, and books for users and developers. The Stan currently defaults to No-U-Turn (NUTS) sampling, which consists of a Hamiltonian Monte Carlo (HMC) extension that explores the posterior distribution more efficiently, access to Stan can be established through several modules integration such as rstan.
- Install the CRAN version:
install.packages("spsurv")
- Installation using the devtools package:
install.packages("devtools")
devtools::install_github("rvpanaro/spsurv")
- Fit a BP based survival regression PH model using:
library("KMsurv")
data("larynx")
library(spsurv)
fit <- bpph(Surv(time, delta) ~ age + factor(stage), model = "ph", data = larynx)
summary(fit)
- Alternatively, one can use the
spbp
function:
fit <- spbp(Surv(time, delta) ~ age + factor(stage), model = "ph", data = larynx)
summary(fit)
- Access to Bayesian analysis using
approach
argument:
## NUTS sampling (Bayesian)
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.
-
survivor
class. -
survivor
ggplot method. - Deviance, martingale and standard residuals.
- Frailty models coding coverage.
Please report issues at https://github.com/rvpanaro/spsurv/issues or mail it to renatovp@ime.usp.br, we will answer as soon as possible.