pred_surv: Predict survival from a stan_surv object

Description Usage Arguments Value Examples

Description

Predict survival from a stan_surv object

This function predicts the survival from the draws of the posterior.

Usage

1
2
3
4
5
pred_surv(x = NULL, long_x = NULL, mod, unix = FALSE,
  patient_id = "patient_id")

pred_surv(x = NULL, long_x = NULL, mod, unix = FALSE,
  patient_id = "patient_id")

Arguments

post

posterior draws in matrix format

strata

strata

obs

original dataframe defaults to ic2surv

Value

d a plot dataset

Examples

 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))

csetraynor/rstanhaz documentation built on May 9, 2019, 8:14 a.m.