How to calculate Bayes Factor for t-test (equality of two means) with non-normal data?

There are two samples: $x_1, x_2,\ldots, x_{n_1}\sim f$ and $y_1, y_2,\ldots, y_{n_2}\sim g$ (cases of $f$ and $g$ are specified below)

The hypothesis I'd like to check is $H_0: \mu_1 = \mu_2$. For this particular hypothesis I wish to calculate BF.

The choice of prior is one thing, but the other (now more bugging me) is what likelihood function I should slot in into the numerator of Bayes Factor:

$\int L(\mu_1, \mu_2\mid x_1,x_2,\ldots,x_{n_1}, y_1, y_2,\ldots,y_{n_2}) \pi(\mu_1,\mu_2) d\mu_1 d\mu_2$

There are two different cases of data distributions:

  1. $x_1, x_2,\ldots, x_{n_1}\sim Exp(\lambda_1)$ and $y_1, y_2,\ldots, y_{n_2}\sim Exp(\lambda_2)$ (same distribution families)
  2. $x_1, x_2,\ldots, x_{n_1}\sim Exp(\lambda_1)$ and $y_1, y_2,\ldots, y_{n_2}\sim Normal(\mu_y, \sigma_y)$ (different distribution families)
  3. $x_1, x_2,\ldots, x_{n_1}\sim f $ and $y_1, y_2,\ldots, y_{n_2}\sim g$ (not in a closed-form distribution, different families)

1. is Bayes Factor calculated based on likelihood directly from data? Some calculators use the difference in means (Dienes) and some use t-statistics (Gonen; Rouder). The problem is that these calculator are designed for normal datasets.
2. in the second and third case, should I use kind of bootstrap likelihood? Also which or what bootstrap likelihood for what parameter then?

There is also fourth case:
4. $x_1, x_2,\ldots, x_n\sim N(\mu_1, \sigma_1)$ and $y_1, y_2,\ldots, y_n\sim N(\mu_2, \sigma_2)$ (same distribution families), but the answer is already here (link) but the solution can't be transferred on the cases above.

  • $\begingroup$ ...equality of means, I'll correct the question. I already read your book, chapter 2 (normal models). $\endgroup$ Commented Dec 4, 2016 at 16:09

1 Answer 1


If you follow the standard textbooks, the definition of the Bayes factor relies directly on the likelihood function, as e.g. in my book:

Definition 5.1 The Bayes factor is the ratio of the posterior probabilities of the null and the alternative hypotheses over the ratio of the prior probabilities of the null and the alternative hypotheses, i.e., $$ \mathfrak{B}^\pi_{01}(\mathbf{x}) = {P(\theta \in \Theta_ 0\mid \mathbf{x}) \over P(\theta \in \Theta_1\mid \mathbf{x})} \bigg/ {\pi(\theta \in \Theta_ 0) \over \pi(\theta \in \Theta_ 1)}. $$ where $\Theta_ 0$ corresponds to the parameter set under the null hypothesis and $\Theta_ 1$ to the parameter set under the alternative hypothesis.

It can be more easily rewritten as the ratio of marginal likelihoods $$\mathfrak{B}^\pi_{01}(\mathbf{x}) = \dfrac{\int_{\Theta_0} f(\mathbf{x}|\theta) \pi_0(\theta)\, \text{d}\theta}{\int_{\Theta_1} f(\mathbf{x}|\theta) \pi_1(\theta)\, \text{d}\theta}$$which requires the definition of two priors, one on $\Theta_0$ and one on $\Theta_1$ as usually $\Theta_0$ is of measure zero under $\pi_1$.

In your setting,

  1. the null set is$$\Theta_0=\{(\mu_1,\mu_2);\ \mu_1=\mu_2\}$$which is the diagonal of $\Theta_1$;
  2. the likelihood is$$f(\mathbf{x}|\theta)=\prod_{i=1}^{n_1} f^1(x_i|\mu_1)\,\prod_{j=1}^{n_2} f^2(y_j|\mu_2)$$if there are no nuisance parameters in the distributions of either sample;

[as already indicated in a previous answer]

Hence, this formulation applies to your cases 1., 2., and 4. However, there is no generic solution when $f$ and $g$ are unknown distributions. Building a genuine non-parametric Bayesian resolution in this case would prove a challenge.

"...should I use kind of bootstrap likelihood? Also which or what bootstrap likelihood for what parameter then?"

If the distributions $f$ and $g$ are unknown, using such a substitute will have a major impact on the numerical value of the marginal likelihoods, and hence on the decision backed by the Bayes factor, if any. The Bayes factor will reflect and be determined by the tail behaviour of the approximations, not of the original likelihoods.

  • $\begingroup$ Why $\pi(\theta)$ disappeared from right side of the likelihood equation? $\endgroup$ Commented Dec 4, 2016 at 18:21
  • 1
    $\begingroup$ uff... still I can't sit back and do nothing, when I have no closed-form distributions $f,g$ - even you do some Approximate Bayesian Computation (ABC) with no A, so I thought that probably I could follow those steps, is it sensible? $\endgroup$ Commented Dec 4, 2016 at 18:28
  • $\begingroup$ (+1) Yes, if the distributions $f$ and $g$ are known and available for simulation, a form of ABC or other (A)BC like synthetic likelihood can be considered. I however suggest massive caution when interpreting a Bayes factor based on such replacements. $\endgroup$
    – Xi'an
    Commented Dec 4, 2016 at 18:30

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.