It is well known that confidence intervals and testing statistical hypothesis are strongly related. My questions is focused on comparison of means for two groups based on a numerical variable. Let's assume that such hypothesis is tested using t-test. On the other side, one can compute confidence intervals for means of both groups. Is there any relation between overlapping of confidence intervals and the rejection of the null hypothesis that means are equal (in favor of the alternative that means differ - two-sided test)? For example, a test could reject the null hypothesis iff the confidence intervals do not overlap.


3 Answers 3


Yes, there are some simple relationships between confidence interval comparisons and hypothesis tests in a wide range of practical settings. However, in addition to verifying the CI procedures and t-test are appropriate for our data, we must check that the sample sizes are not too different and that the two sets have similar standard deviations. We also should not attempt to derive highly precise p-values from comparing two confidence intervals, but should be glad to develop effective approximations.

In trying to reconcile the two replies already given (by @John and @Brett), it helps to be mathematically explicit. A formula for a symmetric two-sided confidence interval appropriate for the setting of this question is

$$\text{CI} = m \pm \frac{t_\alpha(n) s}{\sqrt{n}}$$

where $m$ is the sample mean of $n$ independent observations, $s$ is the sample standard deviation, $2\alpha$ is the desired test size (maximum false positive rate), and $t_\alpha(n)$ is the upper $1-\alpha$ percentile of the Student t distribution with $n-1$ degrees of freedom. (This slight deviation from conventional notation simplifies the exposition by obviating any need to fuss over the $n$ vs $n-1$ distinction, which will be inconsequential anyway.)

Using subscripts $1$ and $2$ to distinguish two independent sets of data for comparison, with $1$ corresponding to the larger of the two means, a non-overlap of confidence intervals is expressed by the inequality (lower confidence limit 1) $\gt$ (upper confidence limit 2); viz.,

$$m_1 - \frac{t_\alpha(n_1) s_1}{\sqrt{n_1}} \gt m_2 + \frac{t_\alpha(n_2) s_2}{\sqrt{n_2}}.$$

This can be made to look like the t-statistic of the corresponding hypothesis test (to compare the two means) with simple algebraic manipulations, yielding

$$\frac{m_1-m_2}{\sqrt{s_1^2/n_1 + s_2^2/n_2}} \gt \frac{s_1\sqrt{n_2}t_\alpha(n_1) + s_2\sqrt{n_1}t_\alpha(n_2)}{\sqrt{n_1 s_2^2 + n_2 s_1^2}}.$$

The left hand side is the statistic used in the hypothesis test; it is usually compared to a percentile of a Student t distribution with $n_1+n_2$ degrees of freedom: that is, to $t_\alpha(n_1+n_2)$. The right hand side is a biased weighted average of the original t distribution percentiles.

The analysis so far justifies the reply by @Brett: there appears to be no simple relationship available. However, let's probe further. I am inspired to do so because, intuitively, a non-overlap of confidence intervals ought to say something!

First, notice that this form of the hypothesis test is valid only when we expect $s_1$ and $s_2$ to be at least approximately equal. (Otherwise we face the notorious Behrens-Fisher problem and its complexities.) Upon checking the approximate equality of the $s_i$, we could then create an approximate simplification in the form

$$\frac{m_1-m_2}{s\sqrt{1/n_1 + 1/n_2}} \gt \frac{\sqrt{n_2}t_\alpha(n_1) + \sqrt{n_1}t_\alpha(n_2)}{\sqrt{n_1 + n_2}}.$$

Here, $s \approx s_1 \approx s_2$. Realistically, we should not expect this informal comparison of confidence limits to have the same size as $\alpha$. Our question then is whether there exists an $\alpha'$ such that the right hand side is (at least approximately) equal to the correct t statistic. Namely, for what $\alpha'$ is it the case that

$$t_{\alpha'}(n_1+n_2) = \frac{\sqrt{n_2}t_\alpha(n_1) + \sqrt{n_1}t_\alpha(n_2)}{\sqrt{n_1 + n_2}}\text{?}$$

It turns out that for equal sample sizes, $\alpha$ and $\alpha'$ are connected (to pretty high accuracy) by a power law. For instance, here is a log-log plot of the two for the cases $n_1=n_2=2$ (lowest blue line), $n_1=n_2=5$ (middle red line), $n_1=n_2=\infty$ (highest gold line). The middle green dashed line is an approximation described below. The straightness of these curves belies a power law. It varies with $n=n_1=n_2$, but not much.

Plot 1

The answer does depend on the set $\{n_1, n_2\}$, but it is natural to wonder how much it really varies with changes in the sample sizes. In particular, we could hope that for moderate to large sample sizes (maybe $n_1 \ge 10, n_2 \ge 10$ or thereabouts) the sample size makes little difference. In this case, we could develop a quantitative way to relate $\alpha'$ to $\alpha$.

This approach turns out to work provided the sample sizes are not too different from each other. In the spirit of simplicity, I will report an omnibus formula for computing the test size $\alpha'$ corresponding to the confidence interval size $\alpha$. It is

$$\alpha' \approx e \alpha^{1.91};$$

that is,

$$\alpha' \approx \exp(1 + 1.91\log(\alpha)).$$

This formula works reasonably well in these common situations:

  • Both sample sizes are close to each other, $n_1 \approx n_2$, and $\alpha$ is not too extreme ($\alpha \gt .001$ or so).

  • One sample size is within about three times the other and the smallest isn't too small (roughly, greater than $10$) and again $\alpha$ is not too extreme.

  • One sample size is within three times the other and $\alpha \gt .02$ or so.

The relative error (correct value divided by the approximation) in the first situation is plotted here, with the lower (blue) line showing the case $n_1=n_2=2$, the middle (red) line the case $n_1=n_2=5$, and the upper (gold) line the case $n_1=n_2=\infty$. Interpolating between the latter two, we see that the approximation is excellent for a wide range of practical values of $\alpha$ when sample sizes are moderate (around 5-50) and otherwise is reasonably good.

Plot 2

This is more than good enough for eyeballing a bunch of confidence intervals.

To summarize, the failure of two $2\alpha$-size confidence intervals of means to overlap is significant evidence of a difference in means at a level equal to $2e \alpha^{1.91}$, provided the two samples have approximately equal standard deviations and are approximately the same size.

I'll end with a tabulation of the approximation for common values of $2\alpha$. In the left hand column is the nominal size $2\alpha$ of the original confidence interval; in the right hand column is the actual size $2\alpha^\prime$ of the comparison of two such intervals:

$$\begin{array}{ll} 2\alpha & 2\alpha^\prime \\ \hline 0.1 &0.02\\ 0.05 &0.005\\ 0.01 &0.0002\\ 0.005 &0.00006\\ \end{array}$$

For example, when a pair of two-sided 95% CIs ($2\alpha=.05$) for samples of approximately equal sizes do not overlap, we should take the means to be significantly different, $p \lt .005$. The correct p-value (for equal sample sizes $n$) actually lies between $.0037$ ($n=2$) and $.0056$ ($n=\infty$).

This result justifies (and I hope improves upon) the reply by @John. Thus, although the previous replies appear to be in conflict, both are (in their own ways) correct.

  • $\begingroup$ May I ask you how we should interpret, instead, the fact that the two confidence intervals are overlapping? $\endgroup$
    – Star
    Commented Oct 7, 2020 at 10:14
  • $\begingroup$ @user3285148 I don't understand what you are asking for, because the whole point of my post here is to provide an interpretation of overlapping CIs. $\endgroup$
    – whuber
    Commented Oct 7, 2020 at 11:47
  • $\begingroup$ Sorry for my silly question. I was referring to one of your last statements "For example, when a pair of two-sided 95% CIs ($2\alpha=.05$) for samples of approximately equal sizes do not overlap, we should take the means to be significantly different, $p \lt .005$. The correct p-value (for equal sample sizes $n$) actually lies between $.0037$ ($n=2$) and $.0056$ ($n=\infty$)." I was trying to produce a similar statement for the opposite case: "For example, when a pair of two-sided 95% CIs ($2\alpha=.05$) for samples of approximately equal sizes overlap, we should take the means to be ..." $\endgroup$
    – Star
    Commented Oct 7, 2020 at 12:10
  • 1
    $\begingroup$ @user3285148 I see -- thank you for your explanation. Unfortunately, "overlap" is not sufficiently quantitative to support any such conclusion, because intervals can barely overlap or overlap almost wholly. $\endgroup$
    – whuber
    Commented Oct 7, 2020 at 12:15
  • 1
    $\begingroup$ @user3285148 That sounds fair, but I would favor a subtle change from "we cannot reject" to "we do not reject ... ." The reason is that the decision not to reject is based on this particular analysis, but it does not preclude the possibility that a better (more powerful) procedure would reject the null. That's a little more important in this circumstance because comparing two CIs is probably not the greatest procedure around. $\endgroup$
    – whuber
    Commented Oct 7, 2020 at 12:30

Under typical assumptions of equal variance, yes, there is a relationship. If the bars overlap by less than the length of one bar * sqrt(2) then a t-test would find them to be significantly different at alpha = 0.05. If the ends of the bars just barely touch then a difference would be found at 0.01. If the confidence intervals for the groups are not equal one typically takes the average and applies the same rule.

Alternatively, if the width of a confidence interval around one of the means is w then the least significant difference between two values is w * sqrt(2). This is simple when you think of the denominator in the independent groups t-test, sqrt(2*MSE/n), and the factor for the CI which, sqrt(MSE/n).

(95% CIs assumed)

There's a simple paper on making inferences from confidence intervals around independent means here. It will answer this question and many other related ones you may have.

Cumming, G., & Finch, S. (2005, March). Inference by eye: confidence intervals, and how to read pictures of data. American Psychologist, 60(2), 170-180.

  • 3
    $\begingroup$ I believe you need also to assume the two groups have the same sizes. $\endgroup$
    – whuber
    Commented Nov 10, 2011 at 23:28
  • $\begingroup$ roughly, yes... $\endgroup$
    – John
    Commented Nov 15, 2011 at 20:26

No, not a simple one at least.

There is, however, an exact correspondence between the t-test of difference between two means and the confidence interval for the difference between the two means.

If the confidence interval for the difference between two means contains zero, a t-test for that difference would fail to reject null at the same level of confidence. Likewise if the confidence interval does not contain 0, the t-test would reject the null.

This is not the same as overlap between confidence intervals for each of the two means.

  • $\begingroup$ The reply by @John, which although at present is not quite right in the details, correctly points out that yes, you can relate overlaps of CIs to test p-values. The relationship is not any more complex than the t-test itself. This has the appearance of contradicting your primary conclusion as stated in the first line. How would you resolve this difference? $\endgroup$
    – whuber
    Commented Nov 11, 2011 at 15:12
  • 1
    $\begingroup$ I don't think they are contradictory. I can add some caveats. But, in the general sense, without additional assumptions and knowledge about parameters outside of the presentation of the interval (the variance, the sample size) the response stands as is. No, not a simple one at least. $\endgroup$
    – Brett
    Commented Nov 11, 2011 at 15:17

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.