# Inf Bayes factor using brms

**URL:** <https://discourse.mc-stan.org/t/inf-bayes-factor-using-brms/5792>\
**Category:** brms\
**Tags:** bayes-factor\
**Created:** [September 28, 2018, 1:22pm UTC](https://discourse.mc-stan.org/t/inf-bayes-factor-using-brms/5792 "2018-09-28T13:22:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmartel](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@mmartel](https://discourse.mc-stan.org/u/mmartel)\
**Post date:** [September 28, 2018, 1:22pm UTC](https://discourse.mc-stan.org/t/inf-bayes-factor-using-brms/5792/1 "2018-09-28T13:22:05Z")

</div>

Hi all,

I am comparing different models with bayes\_factor from the package brms and have some issues for interpretation.

If I compare the same model but one with Gaussian, and one with Student distribution

fit1 \<- brm(formula = bf(VARIABLE ~ CONDITION + AGE + (1|ID)), save\_all\_pars = TRUE,  
data = myDataFrame)  
fit2 \<- brm(formula = bf(VARIABLE ~ CONDITION + AGE + (1|ID)), save\_all\_pars = TRUE,  
data = myDataFrame, **family = student()**)

Or if I compare one linear with one polynomial model

fit1 \<- brm(formula = bf(VARIABLE ~ CONDITION + AGE + (1|ID)), save\_all\_pars = TRUE,  
data = myDataFrame)  
fit3 \<- brm(formula = bf(VARIABLE ~ CONDITION + **poly(AGE,2)** + (1|ID)), save\_all\_pars = TRUE,  
data = myDataFrame)

I get bayes\_factor = “0” or “inf” depending on which model I put first. How should I interpret that? Does it mean that R can not compute or that one of the model is extremely better ?

Am I doing something wrong here?

Thank you in advance!  
Marie

---

<div class="post-metadata">

**Author:** ![paul.buerkner](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/paul.buerkner/32/3303_2.png) [@paul.buerkner](https://discourse.mc-stan.org/u/paul.buerkner)\
**Post date:** [September 29, 2018, 7:53am UTC](https://discourse.mc-stan.org/t/inf-bayes-factor-using-brms/5792/2 "2018-09-29T07:53:00Z")

</div>

Bayes factors depend critically on the prior distributions and you seem to have used the default ones. For regression coefficients, the default priors are improper flat and thus not (reasoanbly) usable with brms. For a discussion of bayes factors in brms, see [https://rpubs.com/lindeloev/bayes\_factors](https://rpubs.com/lindeloev/bayes_factors)

If you have not so much experience with Bayesian statistics, using Bayes factors correctly is very hard. May may also try `loo()`, which does approximation leave-one-out cross-validation.

---

<div class="post-metadata">

**Author:** ![mmartel](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@mmartel](https://discourse.mc-stan.org/u/mmartel)\
**Post date:** [October 1, 2018, 2:11pm UTC](https://discourse.mc-stan.org/t/inf-bayes-factor-using-brms/5792/3 "2018-10-01T14:11:54Z")

</div>

Thank you! I’ll have a read into that.
