Brms model does not converge - any other solutions than stronger priors?

Hi,

I ran the following model:

cor_genmod <- brm(Correct_emo_int ~ f_group + f_emotion_r + f_percentage + f_gender + 
     f_group*f_emotion_r*f_percentage*f_gender + 
     (1 + f_emotion_r*f_percentage | f_ppn), 
   data = comb2_n, family = 'bernoulli', 
   warmup = 1000, iter = 20000, chains = 6, cores = 4, 
   control = list(adapt_delta = 0.9999, max_treedepth = 15))

This model does not converge (Rhat values > 1.35 and ESS too low).
I do not have information to set stronger priors and I’m a bit at loss at what other options there are left, since I have increased the iterations and the number of chains. I have tried removing the random slope, but that doesn’t help either. Are there any other suggestions as to what might help?

Thanks so much in advance.

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_Netherlands.1252 LC_CTYPE=English_Netherlands.1252 LC_MONETARY=English_Netherlands.1252
[4] LC_NUMERIC=C LC_TIME=English_Netherlands.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] loo_2.1.0 gdata_2.18.0 foreign_0.8-71 brms_2.10.0 Rcpp_1.0.2 rstan_2.19.2
[7] ggplot2_3.2.1 StanHeaders_2.19.0

loaded via a namespace (and not attached):
[1] Brobdingnag_1.2-6 pkgload_1.0.2 gtools_3.8.1 threejs_0.3.1 shiny_1.4.0
[6] assertthat_0.2.1 stats4_3.6.1 remotes_2.1.0 sessioninfo_1.1.1 pillar_1.4.2
[11] backports_1.1.5 lattice_0.20-38 glue_1.3.1 digest_0.6.22 promises_1.1.0
[16] colorspace_1.4-1 htmltools_0.4.0 httpuv_1.5.2 Matrix_1.2-17 plyr_1.8.4
[21] dygraphs_1.1.1.6 pkgconfig_2.0.3 devtools_2.2.1 purrr_0.3.3 xtable_1.8-4
[26] scales_1.0.0 processx_3.4.1 later_1.0.0 tibble_2.1.3 bayesplot_1.7.0
[31] usethis_1.5.1 ellipsis_0.3.0 DT_0.9 withr_2.1.2 shinyjs_1.0
[36] lazyeval_0.2.2 cli_1.1.0 magrittr_1.5 crayon_1.3.4 mime_0.7
[41] memoise_1.1.0 ps_1.3.0 fs_1.3.1 nlme_3.1-140 xts_0.11-2
[46] pkgbuild_1.0.6 colourpicker_1.0 rsconnect_0.8.15 tools_3.6.1 prettyunits_1.0.2
[51] matrixStats_0.55.0 stringr_1.4.0 munsell_0.5.0 callr_3.3.2 compiler_3.6.1
[56] rlang_0.4.1 grid_3.6.1 ggridges_0.5.1 rstudioapi_0.10 htmlwidgets_1.5.1
[61] crosstalk_1.0.0 igraph_1.2.4.1 miniUI_0.1.1.1 base64enc_0.1-3 testthat_2.3.0
[66] gtable_0.3.0 inline_0.3.15 abind_1.4-5 markdown_1.1 reshape2_1.4.3
[71] R6_2.4.0 gridExtra_2.3 rstantools_2.0.0 zoo_1.8-6 bridgesampling_0.7-2
[76] dplyr_0.8.3 fastmap_1.0.1 rprojroot_1.3-2 shinystan_2.5.0 shinythemes_1.1.2
[81] desc_1.2.0 stringi_1.4.3 parallel_3.6.1 tidyselect_0.2.5 coda_0.19-3

A bit hard to draw any conclusions from your post other than your model having problems ;)

Could you explain the predictors and outcome, i.e., what type of data it is, sample size, missing data?

Also, could you write your model in mathematical notation?

Hi,
just edited your post to show the code neatly - you can use triple backticks (```) to do that! :-)
My first guess is that the problem might be that you are including both fixed and varying effect for f_emotion_r * f_percentage. Does your model work when you remove one of those? Or, more generally, start with a simple formula and add terms one by one and let us know which is the most complex model that converges and which is the least complex model that fails.

Also the four way interaction is slightly suspicious, because you would need a crazy big dataset to determine it reliably.

I am with @torkar, that we would need more information about your dataset to help your more effectively.

Best of luck with your model!

1 Like

Thanks both! I tried to run the model without the random slope in there to see whether that would work now. It decreased the Rhat values a little bit, but that’s all.

A model with a three-way interaction, but not the four-way interaction works. So the problem is in the four-way interaction with Gender.

A bit more information about the model: I am trying to predict accuracy in decoding emotional faces.

The outcome variable Correct_emo_int is an integer variable coded 0/1 for right or wrong emotion picked

f_group is the clinical group the person belongs to: anxious, non-anxious, socially anxious

f_emotion_r is the emotion they have to categorise: happy, angry, fear

f_percentage_r is the valence intensity percentage at which the emotion is shown: 10, 30, 50, 70%

f_gender is the gender of the participant: male, female

I have added the interaction between all of them as well.

There is no missing data in the dataframe.

The number of observations in the model is 11104 (across sample size of 140 participants).

1 Like

It could be an issue with complete separation in certain cells of your four way interaction. Only stronger priors could help you there or the exclusion of the problematic combinations as you described.

1 Like

+1 to what Paul says. Also, doing partial pooling of all the effects might be sensible, e.g. something like:

Correct_emo_int ~ 1 + (1|f_group*f_emotion_r*f_percentage*f_gender)

Agreed The * needs to be replaced by : in the expression though.

1 Like

Thank you all so much for the helpful tips. I will try out all of them and report back which finally helped.