I have two questions regarding specifying and interpreting Repeated Measures Binomial Models in BRMS

We have a set of data in the following format:

| ID | Cond | Response |
|  1 |    0 |        0 |
|  1 |    0 |        0 |
|  1 |    0 |        1 |
|  2 |    1 |        1 |
|  2 |    1 |        1 |
|  2 |    1 |        0 |
|  3 |    0 |        0 |
|  3 |    0 |        1 |
|  3 |    0 |        0 |

That is, three yes/no measures of Response are taken for each participant, each of whom is assigned to one of two conditions.

We would like to determine whether Condition has an effect on Response, using BRMS.

From what I can tell, the way to specify this model is:

Response | trials(1) ~ Condition + (1 |ID)

Specified more fully as:

fit <- brm(Response | trials(1) ~ Condition + (1 | ID), data=mydata, family=binomial, prior = prior(normal(0, 10), class = b))

Question 1: Is this the correct model specification?

This gives us the following model output:

Group-Level Effects: 
~ID (Number of levels: 30) 
              Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
sd(Intercept)     8.71      3.56     3.91    17.65       1264 1.00

Population-Level Effects: 
          Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
Intercept     8.72      3.67     3.29    17.60        886 1.01
CondB        -7.83      4.38   -17.66    -0.78        882 1.00

We're now trying to interpret these results.

Question 2: Is the following the correct way to interpret this model?

Response is 7.83 times more likely [0.78,17.66] to be 1 in Condition 0 than in Condition 1

Bonus question: We're not entirely clear on how best to select and specify priors. We have some prior evidence suggesting that when some other factor was changed (not the same thing as our Cond), Response changed from a rate of 1:4 to a rate of 3:1; a 12x change in odds. But we're unclear how to act on this information and use it to select a reasonable prior. Based on this blog post, we tried setting the Prior to normal(0,1); normal(0,10); and normal(0,50). Unfortunately, this produced wildly different results:

normal(0,1) produces an intercept of 4.83 and a CondB coefficient of -0.61.

normal(0,10) produces an intercept of 8.72 and a CondB coefficient of -7.83.

normal(0,50) produces an intercept of 10.68 and a CondB coefficient of -10.51.

When we compare these to a null model

null_fit <- brm(Response | trials(1) ~ (1 | ID), data=mydata, family=binomial, save_all_pars=TRUE)

using bayes_factor(fit,null_fit), we get Bayes Factors of, respectively, 1.14, 4.26, 1.40.

This is quite distressing, as this suggests that our results are very sensitive to choice of prior (weak evidence in favor of an effect when we use the medium-weight prior... and a toss up when we use the strongly informative or weakly informative prior.)

We're not sure what to do now, since we're not sure why we would choose one prior over another, and don't want to do the Bayesian equivalent of p-hacking.

So, bonus question: Ah, Help, Oh No, What Do We Do.


1 Answer 1


Even though I am currently not familiar with brms, logically speaking you are fitting a mixed effects logistic regression. In this case the intercept is the log odds when Cond is zero, and the coefficient for Cond is the log odds ratio between Cond=1 and Cond=0. Note though that the interpretation of these coefficients is conditional on the random intercepts you have included; for more information on this check here.

In your output these coefficients are quite large in magnitude (i.e., to transform to the more easily interpretable scale of odds and odds ratio you need to exponentiate them). This in combination with the behavior you have observed from the different priors suggests that you potentially have a separation issue. In this case, a stronger prior for the fixed effects coefficients is preferable, e.g., the $\mathcal N(0, 1)$ you have tried or a Student’s t prior with mean zero, scale parameter one, and three degrees of freedom.

  • $\begingroup$ Thank you Dimitris! Two follow-up questions: 1. Given the previously observed 12x change in odds in a previous study looking at the same DV (with a qualitatively similar IV), isn't N(0,1) overly conservative? This is the sense we get but it isn't clear to us how to translate those previously observed odds into a reasonably informative yet reasonably conservative prior. 2. Looking into separation, I see there are a lot of varying opinions on how to deal with it. What are the advantages of using N(0,1) over something like Cauchy(0,2.5) as suggested by Gelman? $\endgroup$ Jul 1, 2019 at 15:03
  • $\begingroup$ Note that the prior is for the regression coefficients, which are the log odds (intercept) and log odds ratio (IV). Hence, if you have an OR of 12, the log OR is 1.08, which is supported under the N(0, 1) prior. But perhaps you can put a different variance for the prior of the intercept to allow for different baseline odds. $\endgroup$ Jul 5, 2019 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.