Error evaluating the log probability at the initial value

Hi,

I’m trying to run the following model:
percdep_mod_BB ← brm(slidervalue_p_int |trials(100) ~ f_group + f_emotion_r + c_dep + f_group f_emotion_r f_percentage*c_dep + (1 | f_ppn), data = comb, family = beta_binomial2, warmup = 1000, iter = 7000, chains = 4, cores = 6, stanvars = stanvars, control = list(max_treedepth = 15))

However, I keep getting the following error message:
SAMPLING FOR MODEL ‘af0ce5ee5aa92fbbe92b5650b9de8510’ NOW (CHAIN 1).
Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: Exception: beta_binomial_lpmf: Second prior sample size parameter is 0, but must be > 0! (in ‘modele04698d4e41_af0ce5ee5aa92fbbe92b5650b9de8510’ at line 5)
(in ‘modele04698d4e41_af0ce5ee5aa92fbbe92b5650b9de8510’ at line 68)

An almost similar model without the c_dep (centered predictor depression score), so with a three-way interaction runs perfectly.

I have no clue what is going wrong. Thanks a lot for any suggestions!

sessionInfo()
brms version 2.10.0
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
[3] LC_MONETARY=English_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=English_Netherlands.1252

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

other attached packages:
[1] gdata_2.18.0 foreign_0.8-71 brms_2.10.0 Rcpp_1.0.2 rstan_2.19.2
[6] 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] devtools_2.2.1 dygraphs_1.1.1.6 pkgconfig_2.0.3 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 loo_2.1.0
[51] prettyunits_1.0.2 matrixStats_0.55.0 stringr_1.4.0 munsell_0.5.0 callr_3.3.2
[56] compiler_3.6.1 rlang_0.4.1 grid_3.6.1 ggridges_0.5.1 rstudioapi_0.10
[61] htmlwidgets_1.5.1 crosstalk_1.0.0 igraph_1.2.4.1 miniUI_0.1.1.1 base64enc_0.1-3
[66] testthat_2.3.0 codetools_0.2-16 gtable_0.3.0 inline_0.3.15 abind_1.4-5
[71] markdown_1.1 reshape2_1.4.3 R6_2.4.0 gridExtra_2.3 rstantools_2.0.0
[76] zoo_1.8-6 bridgesampling_0.7-2 dplyr_0.8.3 fastmap_1.0.1 rprojroot_1.3-2
[81] shinystan_2.5.0 shinythemes_1.1.2 desc_1.2.0 stringi_1.4.3 parallel_3.6.1
[86] tidyselect_0.2.5 coda_0.19-3

Looks like the second parameter to the beta_binomial lpdf is going to zero. There could be a bug, but this could also just be a finicky model that isn’t easy to evaluate at its initial position.

Can you try calling brm with an init_r=0.1 or something small? By default Stan initializes the unconstrained parameters uniformly on [-2, 2]. This doesn’t work in all models. init_r=0.1 initializes things in [-0.1, 0.1].

If that doesn’t immediately work there’s probly a weirdness with the model/data that needs to be worked out. Give that a go first though and report back.

1 Like

Great, this worked! Thanks so much!