Bayesian inference for proportional hazards regression models. The user can specify a variety of standard parametric distributions for the baseline hazard, or a Royston-Parmar flexible parametric model.
1 2 3 4 5 6 7 | generate_stan_data_2(formula1, formula2, data, basehaz = "fpm",
timescale = "log", df = 5L, degree = 3L, iknots = NULL,
bknots = NULL, prior_1 = normal(), prior_2 = hs(),
prior_intercept = normal(), add_prior = NULL, prior_aux = list(),
prior_PD = FALSE, algorithm = c("sampling", "meanfield", "fullrank"),
adapt_delta = 0.95, max_treedepth = 11L, init = "random", cores = 1L,
out_data = FALSE, ...)
|
1 2 3 4 5 6 7 8 9 10 | pbc2 <- survival::pbc
pbc2 <- pbc2[!is.na(pbc2$trt),]
pbc2$status <- as.integer(pbc2$status > 0)
m1 <- stan_surv(survival::Surv(time, status) ~ trt, data = pbc2)
df <- flexsurv::bc
m2 <- stan_surv(survival::Surv(rectime, censrec) ~ group,
data = df, cores = 1, chains = 1, iter = 2000,
basehaz = "fpm", iknots = c(6.594869, 7.285963 ),
degree = 2, prior_aux = normal(0, 2, autoscale = F))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.