Am running a survival model with brms
the default vague priors give results comparable to standard CPH model. However when I try and add an informative prior, the code just hangs - no errors, nothing. The informative prior is based on some data that suggests an increased HR of about 1.1 for the treatment so I tried adding prior = c(set_prior("normal(0.1,.05)", class = "b")
as I think this needs to be entered on a log scale
head(pace4)
cox_mod <- coxph(Surv(time, status) ~ treat, data = pace4)
summary(cox_mod) # works fine
#Call:
# coxph(formula = Surv(time, status) ~ treat, data = pace4)
# n= 960, number of events= 301
# coef exp(coef) se(coef) z Pr(>|z|)
#treat 0.130 1.138 0.117 1.11 0.27
#exp(coef) exp(-coef) lower .95 upper .95
#treat 1.14 0.878 0.905 1.43
mod <- brms::brm(time | cens(1-status) ~treat,
data = pace4, family = cox(), cores =4, refresh = 0, seed =123, , backend = "cmdstanr")
summary(mod) #also works fine
# Family: cox
# Links: mu = log
#Formula: time | cens(1 - status) ~ treat
# Data: pace4 (Number of observations: 960)
#Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
# total post-warmup draws = 4000
#Population-Level Effects:
# Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#Intercept -0.67 0.09 -0.85 -0.51 1.00 3622 2752
#treat 0.08 0.12 -0.15 0.30 1.00 3455 2712
#informative prior
mod2 <- brms::brm(time | cens(1-status) ~treat,
data = pace4, refresh = 0, seed=123, family = cox(),
prior = c(set_prior("normal(0.1,.05)", class = "b"), cores = 4, backend = "cmdstanr")
# just hangs
R version 4.3.1 (2023-06-16)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.5.2
brms_2.19.0
Thanks