Brm running time

Running on brm with 41600 observations have taken 31 hours, which only finished 200 interations. The run code are:

lfm2.2 <- bf(relv~scal.abd+scal.abdsuper+logrich+scal.abd:logrich+scal.abdsuper:logrich+(scal.abd+scal.abdsuper|plotcode),
lprior2.2 <- c(prior(normal(0,100),class="b"), prior(normal(0,100),class="Intercept"),
bayes_t.relv2.2 <- brm(formula=lfm2.2,data=adat2.2,prior=lprior2.2,control = list(adapt_delta = 0.99,max_treedepth=15),cores=no_cores)

If the family change from normal to student, the fitting was much quicker to finish (only about 12 hours). However, the result is not good with Rhats ranging from 1.31 to 2.22.

What should I do to improve the fitting speed? Thanks a lot!

Hi and welcome! I made some edits so it’s easier to read the model code. Do you have plots of relv vs scal.abd and such. Just a few of them to see if your priors make sense. Those priors look really wide to me. But I don’t know what you are modeling here.

1 Like

Many thanks! the plot of relv vs. scal.abd show below. Any suggrestion?

1 Like

I would start with a simple model like relv~scal.abd (of whatever is most interesting to you). I think folks are using weakly informative student_t priors on the intercept as a starting place (I can’t remember if this is current with best practices). And I would place a prior on scal.abd as well.

How many cores are you running (I do 6-8 depending on the machine)? And how many chains (I usually run 4)?

1 Like

Based on the name & plots, scal.abd looks like a scaled version of a skewed variable (potentially zero-inflated count data?). You may have more success with modeling the variable unscaled. Also, like @Ara_Winter mentioned, your priors are very wide, given that most of your values fall between -2 and 2. Lastly, heterogeneous variance makes the model a lot more complex, how long does it take to run without the sigma ~ scal.abd + ... part?


Thank you so much! @Ara_Winter @abartonicek following your suggestions, student_t priors make the model work. Another question I need help about model checking. the qq plot and the plot of residuals vs. fitted values are as below. Also, all Pareto k estimates are ok (k < 0.7). I can say that the model work well?

I’d run through some diagnostic plots. So things like mcmc_trace, ppc_dens_overlay, mcmc_pairs, mcmc_scatter, and posterior_interval. Some (maybe all) are in the tidybayes package.

After that I would write up the model you have as the first model. The second model should have some informed priors that are discipline specific.

Thanks a lot!

1 Like