spbp: The BP Based Semiparametric Survival Analysis Function
Usage
# Default S3 method
spbp(
formula,
degree,
data,
approach = c("mle", "bayes"),
model = c("ph", "po", "aft"),
priors = list(beta = c("normal(0,4)"), gamma = c("lognormal(0,4)"), frailty =
c("gamma(0.01,0.01)")),
cores = .spbp_default_cores(),
scale = TRUE,
dist = NULL,
baseline = NULL,
verbose = FALSE,
chains = 4,
...
)Arguments
- formula
a Surv object with time to event, status and explanatory terms
- degree
Bernstein polynomial degree (integer). If omitted and neither
distnorbaselinesuppliesbernstein(m), the default isceiling(sqrt(n))wherenis the number of rows indata.- data
a data.frame object
- approach
Bayesian or Maximum Likelihood estimation methods; default is
"mle"- model
Bernstein PH (
"ph"), PO ("po"), or AFT ("aft") model; default is"ph"- priors
prior settings for the Bayesian approach; `normal` or `cauchy` for beta; `lognormal` or `loglogistic` for gamma (BP coefficients)
- cores
number of core threads to use (Bayes sampling)
- scale
logical; indicates whether to center and scale the data
- dist
optional baseline specification; use
bernstein(m)for the Bernstein polynomial degree- baseline
optional alias for
dist- verbose
passed to Stan
- chains
number of MCMC chains (Bayes)
- ...
further arguments passed to
rstan::optimizing(MLE) orrstan::sampling(Bayes), e.g.iter,warmup,init.
Value
An object of class spbp. Component degree records the
Bernstein polynomial degree used in the fit (also stored in call$degree).
Details
Right-censored survival data are modeled with a Bernstein-polynomial baseline
and regression on covariates. With approach = "mle", parameters are
estimated by Stan's optimizer and approximate inference uses the Hessian when
available. With approach = "bayes", posterior samples are drawn with
NUTS; use summary, tidy.spbp, and glance.spbp
for output. Covariates are centered and scaled when scale = TRUE
(default).
The returned object includes:
coefficientsRegression estimates on the original covariate scale.
bp.paramBernstein baseline coefficients (
gamma).degreePolynomial degree used (also in
call$degree).loglikMLE: intercept-only and full-model log-likelihoods; Bayes: posterior mean pointwise log-likelihoods.
callMatched call with
approach,model, anddegree.