If you find any of this useful, please consider donating via PayPal to help keep this site going.

Email news@statisticool.com to sign up to receive news and updates

Flattening Intervals


Often in a statistical analysis we're creating confidence intervals to express a probable range for an estimate. For example, something like "The 90% confidence interval for X is [low, up]", indicating that if the experiment was repeated many times, we'd expect 90% of those intervals to contain the true X. We may only create one such interval, but we could create many intervals. For example, what if we had an interval for X for each state? Or what we if create an interval for X each year for 10 years in a row? We may need a simple way to summarize these intervals.

To illustrate this, consider these two intervals:

It is clear that the first interval is completely contained in the second interval, so to summarize this fact, these two intervals can be collapsed or "flattened" into the interval [1, 2.5].

But in this case,

these intervals do not overlap at all, hence we cannot combine them.

In this case,

these intervals have overlap, but only a partial overlap, so it may make sense to flatten them into the interval [1, 4].

For the purpose of flattening intervals, we can use this general logic to check if an interval (low1, up1) overlaps with an interval (low2, up2):

Statistically speaking, if there is no overlap, the confidence intervals are "statistically significant". If there is any overlap, however, we cannot, technically, say the intervals are the same. The intervals still may or may not be statistically different from each other. In this problem, however, our focus isn't so much on issues of statistical significance as it is on summarizing and communicating the set of intervals. That is, we can pretend these intervals are just regular old intervals and not confidence intervals from a statistical process.

The above logic is how to do it in a program. In Excel, however, we can accomplish this graphically. Here is an example with 10 intervals (blue) and the flattened intervals (red):

Please check out this spreadsheet so you can play around with the numbers. Also, check out this R code to do the same via a program. For this example, the R code gives the output

which matches with Excel.

Thanks for reading!

Please anonymously VOTE on the content you have just read:


If you enjoyed any of my content, please consider supporting it in a variety of ways:

AFFILIATE LINK DISCLOSURE: Some links included on this page may be affiliate links. If you purchase a product or service with the affiliate link provided I may receive a small commission (at no additional charge to you). Thank you for the support!