# \#bayes-factor

**URL:** https://discourse.mc-stan.org/tag/bayes-factor/137.md

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

---

## [Interaction is significant, but neither simple effects nor Bayes analysis](https://discourse.mc-stan.org/t/interaction-is-significant-but-neither-simple-effects-nor-bayes-analysis/41357)

<div class="topic-metadata">

**Author:** [@J111](https://discourse.mc-stan.org/u/J111)\
**Replies:** 3\
**Last updated:** [June 9, 2026, 2:45pm UTC](https://discourse.mc-stan.org/t/interaction-is-significant-but-neither-simple-effects-nor-bayes-analysis/41357 "2026-06-09T14:45:41Z")

</div>

I am currently running a 2 x 2 x 2 repeated measures ANCOVA in JASP. I have 2 within factors (animacy, word pairing) and one between factor (group). I have found a significant interaction of animacy \* group. However, wh…

---

## [Evidence ratios when using default priors](https://discourse.mc-stan.org/t/evidence-ratios-when-using-default-priors/4847)

<div class="topic-metadata">

**Author:** [@ivan\_grahek](https://discourse.mc-stan.org/u/ivan_grahek)\
**Replies:** 12\
**Last updated:** [April 29, 2026, 4:12am UTC](https://discourse.mc-stan.org/t/evidence-ratios-when-using-default-priors/4847 "2026-04-29T04:12:20Z")

</div>

Hi, I have fitted a multilevel model with an interaction between three factors (3X2X2 factorial design, predicting EEG amplitudes with several experimental conditions, i.e., categorical variables) with varying slopes an…

---

## [Advice on Bayes factor analysis (logml could not be estimated within maxiter)](https://discourse.mc-stan.org/t/advice-on-bayes-factor-analysis-logml-could-not-be-estimated-within-maxiter/40761)

<div class="topic-metadata">

**Author:** [@mawilson1234](https://discourse.mc-stan.org/u/mawilson1234)\
**Replies:** 2\
**Last updated:** [December 30, 2025, 6:18am UTC](https://discourse.mc-stan.org/t/advice-on-bayes-factor-analysis-logml-could-not-be-estimated-within-maxiter/40761 "2025-12-30T06:18:26Z")

</div>

I’m running into issues doing a Bayes factor analysis on a dataset I’ve gathered. The model I’m fitting is a pretty simple logistic regression: correct ~ voice\_n + (1 + voice\_n | subject) + (1 | item:voice\_n) …

---

## [Directly using contrasts as predictors in brms to get BFs - a valid approach?](https://discourse.mc-stan.org/t/directly-using-contrasts-as-predictors-in-brms-to-get-bfs-a-valid-approach/40371)

<div class="topic-metadata">

**Author:** [@Lukas\_Dorsch](https://discourse.mc-stan.org/u/Lukas_Dorsch)\
**Replies:** 0\
**Last updated:** [September 16, 2025, 5:45pm UTC](https://discourse.mc-stan.org/t/directly-using-contrasts-as-predictors-in-brms-to-get-bfs-a-valid-approach/40371 "2025-09-16T17:45:27Z")

</div>

Hi everyone. I study Psychology and plan to do some Bayesian contrast analyses (e.g. a 2x2 interaction contrast within a larger 2x3 design). I’ve read through some documentation of bayestestR and brms as well as some in…

---

## [Help with Bayesian Model Comparison for Hierarchical Models](https://discourse.mc-stan.org/t/help-with-bayesian-model-comparison-for-hierarchical-models/39562)

<div class="topic-metadata">

**Author:** [@als\_che](https://discourse.mc-stan.org/u/als_che)\
**Replies:** 2\
**Last updated:** [June 10, 2025, 9:41am UTC](https://discourse.mc-stan.org/t/help-with-bayesian-model-comparison-for-hierarchical-models/39562 "2025-06-10T09:41:41Z")

</div>

Hi everyone, I’m struggling to compute meaningful Bayes Factors or model comparison metrics for a hierarchical model, possibly because my background is more frequentist. Here’s my problem: I have repeated measurements…

---

## [Bayes factors for intercept (BRMS)](https://discourse.mc-stan.org/t/bayes-factors-for-intercept-brms/38480)

<div class="topic-metadata">

**Author:** [@Jacquie](https://discourse.mc-stan.org/u/Jacquie)\
**Replies:** 2\
**Last updated:** [January 20, 2025, 6:16pm UTC](https://discourse.mc-stan.org/t/bayes-factors-for-intercept-brms/38480 "2025-01-20T18:16:06Z")

</div>

I have data from 24 participants who completed each two conditions. I have computed the difference between the two conditions and I want to know whether that difference is negative (one-tailed t-test). Depending on the m…

---

## [Half-normal prior for categorical factor](https://discourse.mc-stan.org/t/half-normal-prior-for-categorical-factor/5046)

<div class="topic-metadata">

**Author:** [@mante](https://discourse.mc-stan.org/u/mante)\
**Replies:** 9\
**Last updated:** [December 2, 2024, 12:52pm UTC](https://discourse.mc-stan.org/t/half-normal-prior-for-categorical-factor/5046 "2024-12-02T12:52:10Z")

</div>

sorry if this is a stupid question, but how do I specify a half-normal (or folded) prior in brms in order to test a directional hypothesis of a categorical variable on normally distributed data (in my case, effect of une…

---

## [Calculating Bayes Factor for Hypothesis Testing of Copula-Based Correlation from MCMC Samples](https://discourse.mc-stan.org/t/calculating-bayes-factor-for-hypothesis-testing-of-copula-based-correlation-from-mcmc-samples/36854)

<div class="topic-metadata">

**Author:** [@Corey.Plate](https://discourse.mc-stan.org/u/Corey.Plate)\
**Replies:** 1\
**Last updated:** [October 11, 2024, 9:58pm UTC](https://discourse.mc-stan.org/t/calculating-bayes-factor-for-hypothesis-testing-of-copula-based-correlation-from-mcmc-samples/36854 "2024-10-11T21:58:37Z")

</div>

Hey everyone, Our lab has run a model that uses a copula with a uniform prior to calculate the correlation between groups of parameters in a hierarchical model with a custom likelihood function. I will display the model…

---

## [Bridge sampling is not compatible with the \`stan\_surv\` object](https://discourse.mc-stan.org/t/bridge-sampling-is-not-compatible-with-the-stan-surv-object/36552)

<div class="topic-metadata">

**Author:** [@DexterW](https://discourse.mc-stan.org/u/DexterW)\
**Replies:** 0\
**Last updated:** [September 11, 2024, 3:41am UTC](https://discourse.mc-stan.org/t/bridge-sampling-is-not-compatible-with-the-stan-surv-object/36552 "2024-09-11T03:41:55Z")

</div>

I am trying to obtain the bridge sampling estimate of the log marginal likelihood for a Bayesian Cox regression model. The bridgesampling::bridge\_sampler function works with brms::brm objects but not with rstanarm::stan…

---

## [Setting priors to produce bayesian comparison - syntax](https://discourse.mc-stan.org/t/setting-priors-to-produce-bayesian-comparison-syntax/35593)

<div class="topic-metadata">

**Author:** [@agata](https://discourse.mc-stan.org/u/agata)\
**Replies:** 3\
**Last updated:** [July 6, 2024, 9:13am UTC](https://discourse.mc-stan.org/t/setting-priors-to-produce-bayesian-comparison-syntax/35593 "2024-07-06T09:13:24Z")

</div>

I’m trying to replicate the analysis from this code (OSF) and compare two models that have either 2 or 6 predictor variables, but I don’t really understand the syntax for setting the priors. My models are: prior1 \<- c(…

---

## [How to obtain Bayes Factor for model comparison with CmdStanR fit object?](https://discourse.mc-stan.org/t/how-to-obtain-bayes-factor-for-model-comparison-with-cmdstanr-fit-object/34569)

<div class="topic-metadata">

**Author:** [@Haoran\_Matt\_Wan](https://discourse.mc-stan.org/u/Haoran_Matt_Wan)\
**Replies:** 1\
**Last updated:** [March 22, 2024, 7:41pm UTC](https://discourse.mc-stan.org/t/how-to-obtain-bayes-factor-for-model-comparison-with-cmdstanr-fit-object/34569 "2024-03-22T19:41:32Z")

</div>

Hi everyone - I am trying to obtain Bayes Factors for model comparison (more than two models), and I used cmdstan\_stan to fit all models. I’ve tried functions from different packages such as bayestestR and brms but fai…

---

## [Trouble formulating an equivalence hypothesis test in Stan](https://discourse.mc-stan.org/t/trouble-formulating-an-equivalence-hypothesis-test-in-stan/32530)

<div class="topic-metadata">

**Author:** [@screachingfire](https://discourse.mc-stan.org/u/screachingfire)\
**Replies:** 4\
**Last updated:** [September 2, 2023, 2:05am UTC](https://discourse.mc-stan.org/t/trouble-formulating-an-equivalence-hypothesis-test-in-stan/32530 "2023-09-02T02:05:57Z")

</div>

I am having an issue trying to formulate a hypothesis. The question feels simple: I am trying to find the probability that two populations have the same parameters(\\boldsymbol{\\theta}\_A = \\boldsymbol{\\theta}\_B). For cont…

---

## [Newbie questions about Bayes factors](https://discourse.mc-stan.org/t/newbie-questions-about-bayes-factors/32363)

<div class="topic-metadata">

**Author:** [@blokeman](https://discourse.mc-stan.org/u/blokeman)\
**Replies:** 4\
**Last updated:** [August 8, 2023, 4:33am UTC](https://discourse.mc-stan.org/t/newbie-questions-about-bayes-factors/32363 "2023-08-08T04:33:08Z")

</div>

I just heard about Bayes factors for the first time. Why is it such a big deal having to compare the posterior probabilities of two models? Isn’t a model’s posterior probability simply exp(elpd\_loo+p\_loo)? Sounds easy to…

---

## [Running bayes factor on measurement error models is producing weird results](https://discourse.mc-stan.org/t/running-bayes-factor-on-measurement-error-models-is-producing-weird-results/30969)

<div class="topic-metadata">

**Author:** [@mawilson1234](https://discourse.mc-stan.org/u/mawilson1234)\
**Replies:** 9\
**Last updated:** [April 12, 2023, 2:57pm UTC](https://discourse.mc-stan.org/t/running-bayes-factor-on-measurement-error-models-is-producing-weird-results/30969 "2023-04-12T14:57:22Z")

</div>

I have two models that I want to compare using bayes\_factor. The first model predicts a continuous variable (y) using two categorical predictors (x, z) and their interaction. This is data from a psycholinguistic study, s…

---

## [Calculating the Bayes factor for a directional hypothesis?](https://discourse.mc-stan.org/t/calculating-the-bayes-factor-for-a-directional-hypothesis/30846)

<div class="topic-metadata">

**Author:** [@JRPhillips](https://discourse.mc-stan.org/u/JRPhillips)\
**Replies:** 3\
**Last updated:** [March 28, 2023, 12:54pm UTC](https://discourse.mc-stan.org/t/calculating-the-bayes-factor-for-a-directional-hypothesis/30846 "2023-03-28T12:54:38Z")

</div>

I’m trying to figure out how to calculate the Bayes Factor for a directional hypothesis test of the form P(\\beta \> 0 | X) relative to P(\\beta \< 0 | X). But I can’t figure out the best way to do this in the Stan framework…

---

## [Simplex variable error during bridgesampling](https://discourse.mc-stan.org/t/simplex-variable-error-during-bridgesampling/30811)

<div class="topic-metadata">

**Author:** [@anikokusztor](https://discourse.mc-stan.org/u/anikokusztor)\
**Replies:** 2\
**Last updated:** [March 21, 2023, 9:35pm UTC](https://discourse.mc-stan.org/t/simplex-variable-error-during-bridgesampling/30811 "2023-03-21T21:35:47Z")

</div>

Hi all, I have been stuck with this problem for a few days now and I would really appreciate anyone’s input: I would like to compare two brm models with Bayes Factor but something goes wrong during bridesampling. Data…

---

## [Interpretation of evidence ratio for directed hypotheses](https://discourse.mc-stan.org/t/interpretation-of-evidence-ratio-for-directed-hypotheses/6021)

<div class="topic-metadata">

**Author:** [@rongmu](https://discourse.mc-stan.org/u/rongmu)\
**Replies:** 2\
**Last updated:** [May 18, 2022, 4:27am UTC](https://discourse.mc-stan.org/t/interpretation-of-evidence-ratio-for-directed-hypotheses/6021 "2022-05-18T04:27:58Z")

</div>

Hi there, @paul.buerkner has provided the proof that evidence ratio for directed hypotheses, e.g., p(\\theta\>0)/p(\\theta\<0), is equivalent to a Bayes factor (https://github.com/paul-buerkner/brms/issues/311). I wonder w…

---

## [Bridge sampling with the latest rstan (yet again not working)](https://discourse.mc-stan.org/t/bridge-sampling-with-the-latest-rstan-yet-again-not-working/27071)

<div class="topic-metadata">

**Author:** [@bnicenboim](https://discourse.mc-stan.org/u/bnicenboim)\
**Replies:** 5\
**Last updated:** [April 8, 2022, 2:41pm UTC](https://discourse.mc-stan.org/t/bridge-sampling-with-the-latest-rstan-yet-again-not-working/27071 "2022-04-08T14:41:41Z")

</div>

Hi, yet again I’m trying my luck with the latest rstan and bridge sampling and no success. I have Linux, I’ve installed rstan like this, which seems to work so far. remove.packages(c("StanHeaders", "rstan")) install.pa…

---

## [Bayes factor favours reduced model without the predictor of interest: how do to explain?](https://discourse.mc-stan.org/t/bayes-factor-favours-reduced-model-without-the-predictor-of-interest-how-do-to-explain/26791)

<div class="topic-metadata">

**Author:** [@TommasoCurro](https://discourse.mc-stan.org/u/TommasoCurro)\
**Replies:** 1\
**Last updated:** [March 18, 2022, 2:40am UTC](https://discourse.mc-stan.org/t/bayes-factor-favours-reduced-model-without-the-predictor-of-interest-how-do-to-explain/26791 "2022-03-18T02:40:57Z")

</div>

Hello, I have compared two models with the same priors using the Bayes factor function in brms. Model 1 is: ACC1\_post.bmodel = brm(correctResponse ~ conditionStimuli \* sequenceTrials + (conditionStimuli \* sequenceTr…

---

## [Bayes factor using "hypothesis" function: Binomial w/ and w/o logit link](https://discourse.mc-stan.org/t/bayes-factor-using-hypothesis-function-binomial-w-and-w-o-logit-link/26366)

<div class="topic-metadata">

**Author:** [@Farzin\_Shamloo](https://discourse.mc-stan.org/u/Farzin_Shamloo)\
**Replies:** 1\
**Last updated:** [March 15, 2022, 6:41pm UTC](https://discourse.mc-stan.org/t/bayes-factor-using-hypothesis-function-binomial-w-and-w-o-logit-link/26366 "2022-03-15T18:41:48Z")

</div>

Hi, I was trying to learn Bayes factors and how to get them via ‘brms’ and so I tried to replicate this blog post: Bayes factor brms blog I also happen to read this paper: proportion puzzle In which it says that usin…

---

## [Contradictory results for model comparison when using ELPD-LOO versus Bayes Factors](https://discourse.mc-stan.org/t/contradictory-results-for-model-comparison-when-using-elpd-loo-versus-bayes-factors/26198)

<div class="topic-metadata">

**Author:** [@teunvg](https://discourse.mc-stan.org/u/teunvg)\
**Replies:** 2\
**Last updated:** [February 4, 2022, 9:58am UTC](https://discourse.mc-stan.org/t/contradictory-results-for-model-comparison-when-using-elpd-loo-versus-bayes-factors/26198 "2022-02-04T09:58:26Z")

</div>

Hello all, I have been making my first foray into using brms for mixed effects models and model comparisons, but have been running into a theoretical problem that I can’t quite wrap my head around. I was initially using…

---

## [\`Recompiling the model with 'rstan'\` fails with crash when calculating Bayes factor using \`bayes\_factor()\`](https://discourse.mc-stan.org/t/recompiling-the-model-with-rstan-fails-with-crash-when-calculating-bayes-factor-using-bayes-factor/25743)

<div class="topic-metadata">

**Author:** [@CLRR](https://discourse.mc-stan.org/u/CLRR)\
**Replies:** 4\
**Last updated:** [December 20, 2021, 7:48pm UTC](https://discourse.mc-stan.org/t/recompiling-the-model-with-rstan-fails-with-crash-when-calculating-bayes-factor-using-bayes-factor/25743 "2021-12-20T19:48:00Z")

</div>

Using brms::bayes\_factor() (or bridgesampling::bayes\_factor()), I’m calculating Bayes Factors from the models that I created using brms::brm(..., backend = "cmdstanr"). As reported as a GitHub issue here, Bayes factors …

---

## [Bayes factor using brms](https://discourse.mc-stan.org/t/bayes-factor-using-brms/4469)

<div class="topic-metadata">

**Author:** [@vasishth](https://discourse.mc-stan.org/u/vasishth)\
**Replies:** 23\
**Last updated:** [November 14, 2021, 10:53am UTC](https://discourse.mc-stan.org/t/bayes-factor-using-brms/4469 "2021-11-14T10:53:23Z")

</div>

Hi all, Attached are some data that I am trying to do a Bayes factor analysis on using brms. Reproducible code is below. I set pretty reasonable priors for the fixed effects factors. I am testing the null hypothesis th…

---

## [Segfault with bridgesampling](https://discourse.mc-stan.org/t/segfault-with-bridgesampling/24372)

<div class="topic-metadata">

**Author:** [@bnicenboim](https://discourse.mc-stan.org/u/bnicenboim)\
**Replies:** 2\
**Last updated:** [September 22, 2021, 8:20am UTC](https://discourse.mc-stan.org/t/segfault-with-bridgesampling/24372 "2021-09-22T08:20:52Z")

</div>

Hi, bridgesampling package suddenly stopped working giving an awful segfault even with a tiny dataset, I’m not sure what changed, but it’s not the rstan version or brms or bridgesampling… This is the data and code. I’m…

---

## [Bayes factors change depending on reference level!](https://discourse.mc-stan.org/t/bayes-factors-change-depending-on-reference-level/22364)

<div class="topic-metadata">

**Author:** [@quantumlinguist](https://discourse.mc-stan.org/u/quantumlinguist)\
**Replies:** 11\
**Last updated:** [May 12, 2021, 9:55pm UTC](https://discourse.mc-stan.org/t/bayes-factors-change-depending-on-reference-level/22364 "2021-05-12T21:55:43Z")

</div>

I have a mixed-effects regression model with a binary response variable Yes-No. The predictors are all binary as well. It turns out that when I calculate the Bayes factors for each parameter, the results change based on …

---

## [Compute Bayes factor from cmdstan output using bridgesampling package (error message)](https://discourse.mc-stan.org/t/compute-bayes-factor-from-cmdstan-output-using-bridgesampling-package-error-message/21915)

<div class="topic-metadata">

**Author:** [@scijens](https://discourse.mc-stan.org/u/scijens)\
**Replies:** 4\
**Last updated:** [April 16, 2021, 11:50am UTC](https://discourse.mc-stan.org/t/compute-bayes-factor-from-cmdstan-output-using-bridgesampling-package-error-message/21915 "2021-04-16T11:50:00Z")

</div>

Hi everyone, I ran several computationally intense models (~2-3 weeks/model; so it’s not desirable to re-run these models) with CmdStan and want to compute the Bayes factor for these models. I came across the bridgesamp…

---

## [Confusion about discrete parameter marginalization in manual Bayesian model averaging](https://discourse.mc-stan.org/t/confusion-about-discrete-parameter-marginalization-in-manual-bayesian-model-averaging/21543)

<div class="topic-metadata">

**Author:** [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Replies:** 2\
**Last updated:** [March 28, 2021, 11:04am UTC](https://discourse.mc-stan.org/t/confusion-about-discrete-parameter-marginalization-in-manual-bayesian-model-averaging/21543 "2021-03-28T11:04:08Z")

</div>

EDIT: Turns out I really was confused about marginalization. I think I finally figured it out. Edited to only show what I believe is the correct solution. No more answers needed, unless you believe the current solution i…

---

## [Bayes factors for a series of experiments using posteriors as priors](https://discourse.mc-stan.org/t/bayes-factors-for-a-series-of-experiments-using-posteriors-as-priors/10519)

<div class="topic-metadata">

**Author:** [@JAQuent](https://discourse.mc-stan.org/u/JAQuent)\
**Replies:** 11\
**Last updated:** [March 26, 2021, 11:37am UTC](https://discourse.mc-stan.org/t/bayes-factors-for-a-series-of-experiments-using-posteriors-as-priors/10519 "2021-03-26T11:37:15Z")

</div>

Hey all, I’ve a rather conceptual but still specific question for a current project. This question is likely to come up again in my work and I think is quite relevant for my field (psychology/neuroscience) in terms of w…

---

## [Bayes Factor in Pystan](https://discourse.mc-stan.org/t/bayes-factor-in-pystan/21276)

<div class="topic-metadata">

**Author:** [@xenia](https://discourse.mc-stan.org/u/xenia)\
**Replies:** 2\
**Last updated:** [March 18, 2021, 10:16am UTC](https://discourse.mc-stan.org/t/bayes-factor-in-pystan/21276 "2021-03-18T10:16:31Z")

</div>

Are there any packages or python-conversions from r packages that one can use to find the Bayes Factor of a model in pystan. I know there are a few in R but can’t find anything definitive in python?

---

## [Using rstan to calculate Bayes Factors](https://discourse.mc-stan.org/t/using-rstan-to-calculate-bayes-factors/21121)

<div class="topic-metadata">

**Author:** [@lmoffatt](https://discourse.mc-stan.org/u/lmoffatt)\
**Replies:** 9\
**Last updated:** [March 10, 2021, 12:35am UTC](https://discourse.mc-stan.org/t/using-rstan-to-calculate-bayes-factors/21121 "2021-03-10T00:35:01Z")

</div>

The Evidence of a model is the integral of the posterior likelihood over the space of parameters. If the prior distributions are proper (they integrate to one), you can safely compare different models that describe EXAC…

[Next page](https://discourse.mc-stan.org/tag/bayes-factor/137.md?match_all_tags=true&page=1&tags%5B%5D=bayes-factor)
