In frequentist statistics, there is a close connection between confidence intervals and tests. Using inference about $\mu$ in the $\rm N(\mu,\sigma^2)$ distribution as an example, the $1-\alpha$ confidence interval $$\bar{x}\pm t_{\alpha/2}(n-1)\cdot s/\sqrt{n}$$ contains all values of $\mu$ that aren't rejected by the $t$-test at the significance level $\alpha$.

Frequentist confidence intervals are in this sense inverted tests. (Incidentally, this means that we can interpret the $p$-value as the smallest value of $\alpha$ for which the null value of the parameter would be included in the $1-\alpha$ confidence interval. I find that this can be a useful way to explain what $p$-values really are to people who know a bit of statistics.)

Reading about the decision-theoretic foundation of Bayesian credible regions, I started to wonder whether there is a similar connection/equivalence between credible regions and Bayesian tests.

  • Is there a general connection?
  • If there is no general connection, are there examples where there is a connection?
  • If there is no general connection, how can we see this?
  • $\begingroup$ A related question which I've been wondering about - could someone point me to a paper they consider to be the "gold standard" or "canonical example" of Bayesian hypothesis testing used on a real problem, rather than a toy example. I've never really understood Bayesian hypothesis testing and I think I'd find a good example of its use instructive. $\endgroup$ – Patrick Caldon Jul 10 '12 at 2:45
  • 2
    $\begingroup$ @PatrickCaldon I doubt there is a "golden paper" on this because Bayesian hypothesis testing is formulated in a decision-theoretic framework (therefore it is too wide to be captured in a single paper). The book mentioned in MånsT's answer provides a good material, Berger's books and talks might also be of interest. $\endgroup$ – user10525 Jul 10 '12 at 11:26
  • $\begingroup$ I believe the paper ba.stat.cmu.edu/vol03is01.php can clarify most of our discussion here. $\endgroup$ – Carlos A B Pereira Jul 26 '12 at 13:48
  • $\begingroup$ Thank you, @Carlos! The link doesn't seem to work right now, but I guess that it leads to your 2008 paper in Bayesian Analysis with Stern and Wechsler. I found that a very interesting read! $\endgroup$ – MånsT Jul 26 '12 at 14:14
  • $\begingroup$ Dear MånsT: Bayesian Analysis moved to Project Euclid. Prof. Carlos paper is here: projecteuclid.org/… $\endgroup$ – Zen Jul 26 '12 at 21:15

I managed to come up with an example where a connection exists. It seems to depend heavily on my choice of loss function and the use of composite hypotheses though.

I start with a general example, which is then followed by a simple special case involving the normal distribution.

General example

For an unknown parameter $\theta $, let $\Theta$ be the parameter space and consider the hypothesis $\theta\in\Theta_0$ versus the alternative $\theta\in\Theta_1=\Theta\backslash\Theta_0$.

Let $\varphi$ be a test function, using the notation in Xi'an's The Bayesian Choice (which is sort of backwards to what I at least am used to), so that we reject $\Theta_0$ if $\varphi=0$ and accept $\Theta_0$ if $\varphi=1$. Consider the loss function $$ L(\theta,\varphi) = \begin{cases} 0, & \mbox{if } \varphi=\mathbb{I}_{\Theta_0}(\theta) \\ a_0, & \mbox{if } \theta\in\Theta_0 \mbox{ and }\varphi=0\\ a_1, & \mbox{if } \theta\in\Theta_1 \mbox{ and }\varphi=1. \end{cases} $$ The Bayes test is then $$\varphi^\pi(x)=1\quad \rm if\quad P(\theta\in\Theta_0|x)\geq a_1(a_0+a_1)^{-1}.$$

Take $a_0=\alpha\leq 0.5$ and $a_1=1-\alpha$. The null hypothesis $\Theta_0$ is accepted if $\rm P(\theta\in\Theta_0|x)\geq 1-\alpha$.

Now, a credible region $\Theta_c$ is a region such that $\rm P(\Theta_c|x)\geq 1-\alpha$. Thus, by definition, if $\Theta_0$ is such that $\rm P(\theta\in\Theta_0|x)\geq 1-\alpha$, $\Theta_c$ can be a credible region only if $\rm P(\Theta_0\cap\Theta_c|x)>0$.

We accept the null hypothesis if an only if each $1-\alpha$-credible region contains a non-null subset of $\Theta_0$.

A simpler special case

To better illustrate what kind of test we have in the above example, consider the following special case.

Let $x\sim \rm N(\theta,1)$ with $\theta\sim \rm N(0,1)$. Set $\Theta=\mathbb{R}$, $\Theta_0=(-\infty,0]$ and $\Theta_1=(0,\infty)$, so that we wish to test whether $\theta\leq 0$.

Standard calculations give $$\rm P(\theta\leq 0|x)=\Phi(-x/\sqrt{2}),$$ where $\Phi(\cdot)$ is the standard normal cdf.

Let $z_{1-\alpha}$ be such that $\Phi(z_{1-\alpha})=1-\alpha$. $\Theta_0$ is accepted when $-x/\sqrt{2}>z_{1-\alpha}$.

This is equivalent to accepting when $x\leq \sqrt{2}z_{\alpha}.$ For $\alpha=0.05$, $\Theta_0$ is therefore rejected when $x>-2.33$.

If instead we use the prior $\theta\sim \rm N(\nu,1)$, $\Theta_0$ is rejected when $x>-2.33-\nu$.


The above loss function, where we think that falsely accepting the null hypothesis is worse than falsely rejecting it, may at first glance seem like a slightly artifical one. It can however be of considerable use in situations where "false negatives" can be costly, for instance when screening for dangerous contagious diseases or terrorists.

The condition that all credible regions must contain a part of $\Theta_0$ is actually a bit stronger than what I was hoping for: in the frequentist case the correspondence is between a single test and a single $1-\alpha$ confidence interval and not between a single test and all $1-\alpha$ intervals.


Michael and Fraijo suggested that simply checking whether the parameter value of interested was contained in some credible region was the Bayesian equivalent of inverting confidence intervals. I was a bit skeptical about this at first, since it wasn't obvious to me that this procedure really resulted in a Bayesian test (in the usual sense).

As it turns out, it does - at least if you're willing to accept a certain type of loss functions. Many thanks to Zen, who provided references to two papers that establish a connection between HPD regions and hypothesis testing:

I'll try to summarize them here, for future reference. In analogue with the example in the original question, I'll treat the special case where the hypotheses are $$H_0: \theta\in\Theta_0=\{\theta_0\}\qquad \mbox{and}\qquad H_1: \theta\in\Theta_1=\Theta\backslash \Theta_0,$$ where $\Theta$ is the parameter space.

Pereira & Stern proposed a method for testing said hypotheses without having to put prior probabilities on $\Theta_0$ and $\Theta_1$.

Let $\pi(\cdot)$ denote the density function of $\theta$ and define $$T(x)=\{ \theta:\pi(\theta|x)>\pi(\theta_0|x)\}.$$

This means that $T(x)$ is a HPD region, with credibility $P(\theta\in T(x)|x)$.

The Pereira-Stern test rejects $\Theta_0$ when $P(\theta\notin T(x)|x)$ is "small" ($<0.05$, say). For a unimodal posterior, this means that $\theta_0$ is far out in the tails of the posterior, making this criterion somewhat similar to using p-values. In other words, $\Theta_0$ is rejected at the $5~\%$ level if and only if it is not contained the in $95~\%$ HPD region.

Let the test function $\varphi$ be $1$ if $\Theta_0$ is accepted and $0$ if $\Theta_0$ is rejected. Madruga et al. proposed the loss function $$ L(\theta,\varphi,x) = \begin{cases} a(1-\mathbb{I}(\theta\in T(x)), & \mbox{if } \varphi(x)=0 \\ b+c\mathbb{I}(\theta\in(T(x)), & \mbox{if } \varphi(x)=1, \end{cases} $$ with $a,b,c>0$.

Minimization of the expected loss leads to the Pereira-Stern test where $\Theta_0$ is rejected if $P(\theta\notin T(x)|x)<(b+c)/(a+c).$

So far, all is well. The Pereira-Stern test is equivalent to checking whether $\theta_0$ is in an HPD region and there is a loss function that generates this test, meaning that it is founded in decision theory.

The controversial part though is that the loss function depends on $x$. While such loss functions have appeared in the literature a few times, they don't seem to be generally accepted as being very reasonable.

For further reading on this topic, see a list of papers that cite the Madruga et al. article.

Update October 2012:

I wasn't completely satisfied with the above loss function, as its dependence on $x$ makes the decision-making more subjective than I would like. I spent some more time thinking about this problem and ended up writing a short note about it, posted on arXiv earlier today.

Let $q_{\alpha}(\theta|x)$ denote the posterior quantile function of $\theta$, such that $P(\theta\leq q_{\alpha}(\theta|x))=\alpha$. Instead of HPD sets we consider the central (equal-tailed) interval $(q_{\alpha/2}(\theta|x),q_{1-\alpha/2}(\theta|x))$. To test $\Theta_0$ using this interval can be justified in the decision-theoretic framework without a loss function that depends on $x$.

The trick is to reformulate the problem of testing the point-null hypothesis $\Theta_0=\{\theta_0\}$ as a three-decision problem with directional conclusions. $\Theta_0$ is then tested against both $\Theta_{-1}=\{\theta:\theta<\theta_0\}$ and $\Theta_{1}=\{\theta:\theta>\theta_0\}$.

Let the test function $\varphi=i$ if we accept $\Theta_i$ (note that this notation is the opposite of that used above!). It turns out that under the weighted $0-1$ loss function $$L_2(\theta,\varphi) = \begin{cases} 0, & \mbox{if } \theta\in\Theta_i\mbox{ and }\varphi=i, \quad i\in \{-1,0,1\}, \\ \alpha/2, & \mbox{if } \theta\notin\Theta_0 \mbox{ and }\varphi=0,\\ 1, & \mbox{if } \theta\in\Theta_{i}\cup\Theta_0 \mbox{ and }\varphi=-i,\quad i\in\{-1,1\},\end{cases}$$ the Bayes test is to reject $\Theta_0$ if $\theta_0$ is not in the central interval.

This seems like a quite reasonable loss function to me. I discuss this loss, the Madruga-Esteves-Wechsler loss and testing using credible sets further in the manuscript on arXiv.

  • 2
    $\begingroup$ (I'm marking this as a community wiki) $\endgroup$ – MånsT Jul 26 '12 at 12:21
  • $\begingroup$ When you say "To arrive at the Pereira-Stern test we must minimize the expected posterior loss", well, actually we do that in any Bayesian decision procedure. The difference here is that the loss function depends on data (as you pointed out), which is not standard. Normaly we have $L : \{Parameter\; Space\} \times \{Actions\} \to \mathbb{R}$. $\endgroup$ – Zen Jul 26 '12 at 12:51
  • $\begingroup$ @Zen: Yes, of course, I phrased that wrongly. Thanks for pointing that out. :) $\endgroup$ – MånsT Jul 26 '12 at 13:23
  • 3
    $\begingroup$ @MånsT: (+1) This is an interesting answer. I very much respect the fact you chose to mark this as CW in this instance, but I wish you wouldn't have. :-) $\endgroup$ – cardinal Jul 26 '12 at 13:29

I coincidentally read your arXiv paper prior to coming to this question and already wrote a blog entry on it (scheduled to appear on October, 08). To sum up, I find your construction of theoretical interest, but also think it is too contrived to be recommended, esp. as it does not seem to solve the point-null hypothesis Bayesian testing problem, which traditionally requires to put some prior mass on the point-null parameter value.

To wit, the solution you propose above (in the October update) and as Theorem 2 in your arXiv paper is not a valid test procedure in that $\varphi$ takes three values, rather than the two values that correspond to accept/reject. Similarly, the loss function you use in Theorem 3 (not reproduced here) amounts to testing a one-sided hypothesis, $H_0: \theta\le\theta_0$, rather than a point-null hypothesis $H_0: \theta= \theta_0$.

My major issue however is that it seems to me that both Theorem 3 and Theorem 4 in your arXiv paper are not valid when $H_0$ is a point-null hypothesis, i.e. when $\Theta_0=\{\theta_0\}$, with no prior mass.

  • 1
    $\begingroup$ Thanks (+1) for your comments! I very much look forward to reading your blog post. :) As you point out, Theorems 3 and 4 are concerned with composite hypotheses only. The $1-\alpha/2$ in Theorem 2 is a misprint. It should read $\alpha/2$, in which case $\varphi=0$ when $\alpha/2<\mbox{min}(P(\Theta_{-1}),P(\Theta_1))$, which happens when $\theta_0$ is in the the credible interval. I'll change this in the arXiv manuscript as soon as possible! $\endgroup$ – MånsT Oct 4 '12 at 22:40
  • $\begingroup$ You are right (+1!), I was thinking of the inequality the other way! In the arXiv document, the central inequality is written the wrong way. i.e. one should accept $H_0$ iff $\endgroup$ – Xi'an Oct 5 '12 at 6:49
  • $\begingroup$ That's good to hear :) The updated manuscript (with Thm 2 corrected) will be on arXiv on Monday. I'll make the assumption that $\Theta_0$ is not point-null in Thm 4 explicit as well. $\endgroup$ – MånsT Oct 5 '12 at 6:51
  • 1
    $\begingroup$ Just make sure to clarify the proof of Theorem 2 in the arXiv document: the displayed inequality is written the wrong way. i.e. one should accept $H_0$ iff $P(\theta\in\Theta_i|x)>\alpha/2$, not the opposite! $\endgroup$ – Xi'an Oct 5 '12 at 6:58

You can use a credible interval (or HPD region) for Bayesian hypothesis testing. I don't think it is common; though, to be fair I do not see much nor do I use formal Bayesian Hypothesis testing in practice. Bayes factors are occasionally used (and in Robert's "Bayesian Core" somewhat lauded) in hypothesis testing set up.

  • 1
    $\begingroup$ Cheers @Fraijo! Could you perhaps elaborate a bit on how your answer differ from that of Michael Chernick? $\endgroup$ – MånsT Jul 10 '12 at 11:15
  • 2
    $\begingroup$ I do not think the use of Bayes factors for testing hypothesis is "occasional", see for example this reference. $\endgroup$ – user10525 Jul 10 '12 at 11:19
  • $\begingroup$ @MånsT in his follow up the process Michael describes seems to be a Bayes Factor test. Essentially you create two models with different priors based on your hypothesis and then compare the the probability of the data set based on those priors. The reference Procrasinator posted gives a quick review of this. $\endgroup$ – Fraijo Jul 10 '12 at 16:31
  • 1
    $\begingroup$ @Procrastinator I said occasional only because in my industry I see few people using Bayesian methods, let alone using Bayesian methods for testing hypothesis. Personally I use Bayes factors to check my models for sensitivity to the prior, which I suppose is a form of hypothesis testing. $\endgroup$ – Fraijo Jul 10 '12 at 16:37
  • 1
    $\begingroup$ @MånsT short answer: no. Setting up a credible interval and finding out if it contains the null hypothesis is the only direct test that is comparable to frequentist hypothesis testing. There are two problems with this method: 1) the obvious fact that you can find multiple regions in some cases (e.g. an HPD versus a symmetric region) and 2) testing a point hypothesis (theta = a) conflicts with the Bayesian ideal of parameters taking distributions (theta ~ P(theta)). $\endgroup$ – Fraijo Jul 11 '12 at 4:01

A credible region is just a region where the integral of the posterior density over the region is a specified probability e.g. 0.95. One way to form a Bayesian hypothesis test is to see whether or not the null hypothesized value(s) of the parameter(s) fall in the credible region. In this way we can have a similar 1-1 correspondence between hypothesis tests and credible regions just like the frequentists do with confidence intervals and hypothesis tests. But this is not the only way to do hypothesis testing.

  • $\begingroup$ Are this kind of ad hoc Bayesian tests often used in practice? $\endgroup$ – MånsT Jul 5 '12 at 14:16
  • 1
    $\begingroup$ @MansT I don't think so. I think that usually Bayesians put prior odds on the null hypothesis being true and then based on the data construct posterior odds. If the posterior odds are storngly against the null hypothesis then it is rejected. I am not the best person to ask though since I do not do Bayesian inference very often. $\endgroup$ – Michael R. Chernick Jul 5 '12 at 14:31
  • 2
    $\begingroup$ The test described by Michael is credited to Lindley by Zellner in his book on Bayesian econometrics. $\endgroup$ – Zen Jul 10 '12 at 2:11
  • 1
    $\begingroup$ Yes, these kind of tests are certainly sprung from Bayesian ideas, but I'm not sure if they have a solid foundation in Bayesian decision theory. In the latter setting I would expect tests to be derived from a loss function, typically involving a test function. $\endgroup$ – MånsT Jul 10 '12 at 11:13
  • 2
    $\begingroup$ Dear MånsT, take a look at these papers: mdpi.org/entropy/papers/e1040099.pdf w.ime.usp.br/~jstern/miscellanea/citacoes/swtest1.pdf $\endgroup$ – Zen Jul 10 '12 at 17:42

Let me give it how I got it reading Tim's answer.

It is based on the table views with hypothesis (estimated parameter) in columns and observations in the rows.

enter image description here

In the first table, you have col probabilities sum to 1, i.e. they are conditional probabilities, whose condition, getting into the column event is supplied in the bottom row, called 'prior'. In the last table, rows similarly sum to 1 and in the middle you have joint probabilities, i.e. conditional probabilities you find in the first and last table times the probability of the condition, the priors.

The tables basically perform the Bayesian transform: in the first table, you give p.d.f of the observations (rows) in every column, set the prior for this hypothesis (yes, hypothesis column is a pdf of observations under that hypothesis), you do that for every column and table takes it first into the joint probabilites table and, then into the probabilities of your hypothesis, conditioned by observations.

As I have got from Tim's answer (correct me if I am wrong), the Critical Interval approach looks at the first table. That is, once experiment is complete, we know the row of the table (either heads or tails in my example but you may make more complex experiments, like 100 coin flips and get a table with 2^100 rows). Frequentialist scans through its columns, which, as I have said, is a distribution of possible outcomes under condition that hypothesis colds true (e.g. coin is fair in my example), and rejects those hypothesis (columns) that has give very low probability value at the observed row.

Bayesianist first adjust the probabilities, converting cols into rows and looks at table 3, finds the row of the observed outcome. Since it is also a p.d.f, he goes through the experiment outcome row and picks the highest-prob hypethesis until his 95% credibility pocket is full. The rest of hypothesis is rejected.

How do you like it? I am still in the process of learning and graphic seems helpful to me. I belive that I am on the right track since a reputable user gives the same picture, when analyzes the difference of two approaches. I have proposed a graphical view of the mechanics of hypothesis selection.

I encourage everybody to read that Keith last answer but my picture of hypothesis test mechanics can immediately say that frequentist does not look at the other hypothesis when verifies the current one whereas consideration of high credibile hypothesis highly impacts the reception/rejection of other hypotheses in bayesian analisys because if you have a single hypothesis which occurs 95% of times under observed data, you throw all other hypothesis immediately, regardless how well is data fit within them. Let's put the statistical power analysis, which contrast two hypotheses based on their confidence intervals overlap, aside.

But, I seem have spotted the similarity between two approaches: they seem to be connected through P(A | B) > P(A) <=> P(B|A) > P(B) property. Basically, if there is a dependence between A and B then it will show up as correlation in both freq and bayesian tables. So, doing one hypothesis test correlates with the other, they sorta must give the same results. Studying the roots of the correlation, will likely give you the connection between the two. In my question there I actually ask why is the difference instead of absolute correlation?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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