Brms Causing R Session Aborted (R Encountered Fatal Error) Only With Control Parameters Included

I have been attempting to run a zero-inflated poisson model with the attached data and following code:

Example.csv (21.5 KB)

example<-read.csv(“Example.csv”,header=T)
as.factor(example$ID)->example$ID
as.factor(example$Sex)->example$Sex
as.factor(example$Level)->example$Level
as.factor(example$LesionType)->example$LesionType

formula<-bf(LesionNumber ~ Level + LesionType + Level:LesionType + Sex + AgeDeath + DD + PMI + (1 | ID), zi ~ Level + LesionType + Level:LesionType + Sex + AgeDeath + DD + PMI + (1 | ID))

model<-brm(formula=formula, data=example, family=“zero_inflated_poisson”,warmup=2000,iter=4000,seed=34)

I then received errors about treedepth, Rhat, bulk ESS, and tail ESS. Therefore, I tried to adjust the code with the following:

model.updated<-brm(formula=formula, data=lesion_number_total_staged, family=“zero_inflated_poisson”,warmup=4000,iter=8000,seed=34,control=list(max_treedepth=15))

However, I then get an R Session Aborted error. I’ve never encountered this with recent models and have narrowed down that it only happens when inputting control parameters. Any insight on why this is happening? I’ve tried uninstalling brms, rstan, and rstantools and reinstalling but that didn’t seem to help.

I’m using a MacBook Pro with 16GB memory on Mojave Version 10.14.6 and RStudio version Version 1.4.1717.

I ran into a similar issue the other week with adapt_delta (see here). After a lot of fooling around, the quick fix was to install the developmental version of brms from GitHub.

remotes::install_github("paul-buerkner/brms")
2 Likes

Sorry, did not work for me. Same problem when including the adapt_delta control. Any more thoughts?

That’s frustrating. Sadly, that’s all I’ve got on this one.

Thanks anyway, Solomon! Much appreciated. I try rstanarm now, however, I liked the possibility for multivariate responses in brms. All the best from Norway, Ulrich

1 Like

I just updated to R 4.1.2 on an Intel Mac with Big Sur 11.6 and experienced the same issue. Specifying a model with adapt_delta caused R Studio to crash. I tried uninstalling rstan and brms to no avail but Solomon’s solution appears to have worked.

1 Like

Other users have reported that upgrading to the preview of the next RStan version has solved this problem for them:

remove.packages(c("StanHeaders", "rstan"))
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
2 Likes