Learn R Programming

spsurv (version 1.1.0)

spbp: spbp: The BP Based Survival Analysis Function

Description

Semiparametric Survival Analysis Using Bernstein Polynomial

Usage

spbp(formula, ...)

Value

An object of class "spbp". See spbp.default for the list of components (coefficients, bp.param,

degree, etc.).

Arguments

formula

a Surv response with event time, censoring status, and optional covariates.

...

Arguments passed to spbp.default, including data, model, approach, and degree. Further arguments in ... are passed to rstan::optimizing (MLE) or rstan::sampling (Bayes), e.g. iter, chains, init.

Details

Fits Bernstein PH, PO, or AFT models to survival data via Stan (MLE or Bayesian).

The generic dispatches to spbp.default for formula objects. Convenience wrappers bpph, bppo, and bpaft fix the model family. See vignette("getting-started", package = "spsurv") for a tutorial, vignette("model-families", package = "spsurv") for PH / PO / AFT comparison, and vignette("bp-degree", package = "spsurv") for choosing the Bernstein polynomial degree.

See Also

spbp.default, bpph, bppo, bpaft, bernstein

Examples

Run this code

library("spsurv")
data("veteran", package = "survival")

fit_mle <- spbp(Surv(time, status) ~ karno + factor(celltype),
  data = veteran, model = "po"
)
summary(fit_mle)

fit_bayes <- spbp(Surv(time, status) ~ karno + factor(celltype),
  data = veteran, model = "po", approach = "bayes",
  cores = 1, iter = 300, chains = 1,
  priors = list(
    beta = c("normal(0,5)"),
    gamma = "halfnormal(0,5)"
  )
)

summary(fit_bayes)

Run the code above in your browser using DataLab