I have been struggling time-wise fitting a joint model using stan_jm() from rstanarm pacakge due to large number of individuals (~10,000) and multiple repeated measurements for each individual. The fact that I would like to model time variable with a restricted cubic spline also adds up to the burden. I recreated the structure of the model using the sample code from stan_jm vignette. Please see below.
I was wondering if there is anyway to speed up the MCMC sampling. I don’t think within-chain paralellization with ‘reduce_sum’ is available for rstanarm models but I was hoping there would be a way to incorporate it. Any help would be appreciated! Thank you!
stan_jm( formulaLong = list( logBili ~ age + sex + trt + rms::rcs(year,4) + (rms::rcs(year,4) | id)), formulaEvent = survival::Surv(futimeYears, death) ~ age + sex + trt, dataLong = pbcLong, dataEvent = pbcSurv, assoc = c("etavalue"), time_var = "year", cores=parallel::detectCores(), chains = 2, iter=2000, refresh = 200, seed = 12345, max_treedepth = 18) ****