How to Obtain Relative Risk on Bayesian Logistics Mixed Effect Model?

I have the following model:

m ← brm(formula=outcome ~ x1 + x2 + (1 | ID) + (1 | SCHID), family=bernoulli)
“outcome” is a variable with binary outcomes (1/0) and the output of this model would be log-odds of the variable x1, and x2, and the random intercepts.

My question is, how do I, instead of getting log-odds or odds ratio, to get relative risk, via brms? Can I get the output of the function “conditional_effects” instead of printing an image in the console?

See the discussion at this post and particularly the response here Binomial regression with a log link - #5 by bgoodri

An alternative is to use the {marginaleffects} package (the slopes and avg_slopes functions in particular).

1 Like

Implementing the results provided there yielded different probabilities than one generated via conditional_effects, The conditional_effects plot had much lower probabilities

I suspect that has to due with the defaults in brms for conditional_effects regarding the varying intercepts vs what you calculated manually.
Note, that calculating relative risk or risk difference from logistic regression models is a rather contentious subject. See and the linked paper and the comments by Anders Huitfeldt on the blog post. Also a related and extraordinarily lengthy and somewhat contentious conversation Should one derive risk difference from the odds ratio? - bayes - Datamethods Discussion Forum

1 Like