I have two laptops with relatively good specifications that I use for running Bayesian models, both have up-to-date software and correctly specified stan installation. Stan, brms and rstanarm models compile well. However, when I specify my rstanarm survival models with time-varying (tve()) argument, the running of chains hangs or never ends. No errors are shown.
What may be the problem and how to solve this?
Reproducible example, including data that will be downloaded with code and its continuous variables are already centered.
#data library(tidyverse) data = read_delim("https://www.dropbox.com/s/ufpmejd6do8saq6/shared_data.csv?dl=1", ";", escape_double = FALSE, trim_ws = TRUE) #model library(rstanarm) options(mc.cores = parallel::detectCores()) m1 = stan_surv(formula = Surv(time, status) ~ p1 + p2 + tve(p3) + p4, basehaz = "ms", basehaz_ops = list(df = 8), data = data)
PS! stan_surv() is a function from rstanarm package’s survival branch, following code should be used for its installation (GitHub - stan-dev/rstanarm: rstanarm R package for Bayesian applied regression modeling):
install.packages("rstanarm", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
if the last one didn’t work, causing R to crash, this one helps (Stan_surv crashes R repeatedly - #13 by binman):
install.packages(“StanHeaders”, repos = c(“Repository for distributing (some) stan-dev R packages | r-packages”, getOption(“repos”)))
install.packages(“rstan”, repos = c(“Repository for distributing (some) stan-dev R packages | r-packages”, getOption(“repos”)))