# Error evaluating the log probability at the initial value

**URL:** <https://discourse.mc-stan.org/t/error-evaluating-the-log-probability-at-the-initial-value/11901>\
**Category:** brms\
**Created:** [November 13, 2019, 9:44pm UTC](https://discourse.mc-stan.org/t/error-evaluating-the-log-probability-at-the-initial-value/11901 "2019-11-13T21:44:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![l-psych](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/l-psych/32/6980_2.png) [@l-psych](https://discourse.mc-stan.org/u/l-psych)\
**Post date:** [November 13, 2019, 9:44pm UTC](https://discourse.mc-stan.org/t/error-evaluating-the-log-probability-at-the-initial-value/11901/1 "2019-11-13T21:44:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bbbales2](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bbbales2/32/77_2.png) [@bbbales2](https://discourse.mc-stan.org/u/bbbales2)\
**Post date:** [November 14, 2019, 12:37am UTC](https://discourse.mc-stan.org/t/error-evaluating-the-log-probability-at-the-initial-value/11901/2 "2019-11-14T00:37:19Z")

</div>

> [@l-psych](#):
>
> Exception: beta\_binomial\_lpmf: Second prior sample size parameter is 0, but must be \> 0!

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.

---

<div class="post-metadata">

**Author:** ![l-psych](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/l-psych/32/6980_2.png) [@l-psych](https://discourse.mc-stan.org/u/l-psych)\
**Post date:** [November 15, 2019, 8:20am UTC](https://discourse.mc-stan.org/t/error-evaluating-the-log-probability-at-the-initial-value/11901/3 "2019-11-15T08:20:37Z")

</div>

Great, this worked! Thanks so much!
