# Deduce variance from boxplot

I was wondering how to deduce the variance of a variable using a boxplot. Is it at least possible to deduce if two variables have the same variance observing their boxplot?

-
Recently stumbled on this article about a similar topic. Hope it would give you some insight. – Penguin_Knight Mar 27 '14 at 12:09

Not without a lot of strict assumptions, no. If you were to assume the answer was yes (instead of asking, for which I applaud you), I bet I could fool you with this (counter)example: set.seed(1);boxplot(rnorm(10000),c(-3,-2.65,rep((-2:2)*.674,5),2.65,3))

Looks pretty similar, right? Yet $\sigma^2_1=1,\sigma^2_2=1.96$!

In case it's not clear from the code, population 2 is:

-3.000 -2.650 -1.348 -0.674  0.000  0.674  1.348 -1.348 -0.674  0.000
0.674  1.348 -1.348 -0.674  0.000  0.674  1.348 -1.348 -0.674  0.000
0.674  1.348 -1.348 -0.674  0.000  0.674  1.348  2.650  3.000


And no, you cannot deduce that this population is normal just because it's exactly symmetrical. Here's a Q-Q plot of population 2:

Sure doesn't look normal to me.

Edit – Response to your comment:

Variance is a numeric statistic. If two distributions' variances are literally equal, that's pretty much all you have to say about that. If two distributions are exactly normal, again, there's a mathematical definition they'll both fit. If two distributions are not exactly normal or equal in variance, you shouldn't say otherwise. If you want to say they're approximately equal or normal, you should probably define "approximate enough" in a way that's tailored to your purposes, which you haven't specified here. Sensitivity to distributional differences varies widely across the analyses that usually motivate questions like yours. For example, a parametric $t$-test assumes normal distributions with equal variance (though it's fairly robust to violations of the latter given equal sample sizes), so I wouldn't recommend that test for comparing my population 2 to population 1 (the normal distribution).

-
Good example. Nick is using R. (Until everyone uses R, it's good practice to mention that.) – Nick Cox Mar 27 '14 at 12:22
Can't help thinking that would be a good day for science on the whole :) – Nick Stauner Mar 27 '14 at 12:23
I have a long essay on that, but somehow it won't fit in the space available. – Nick Cox Mar 27 '14 at 12:50
Good answer. Can you write what information we should report in order to say: "They are normal and the variance is the same" – Donbeo Mar 27 '14 at 18:11
Edited to respond. – Nick Stauner Mar 27 '14 at 21:30

This has been well answered. These extra comments are a little too long (UPDATE: now a lot too long) to go as comments.

Strictly, all you can read off a boxplot about the variability of a distribution are its interquartile range (the length or height of the box) and range (the length or height between the extremes of the display).

As an approximation, box plots that seem identical are likely to have very similar variances, but watch out. Box plots with very different box positions or tails (or both) are most unlikely to have similar variances, but it's not impossible. But even if box plots look identical, you get no information in a plain or vanilla box plot about variability within the box or indeed variability within the whiskers (the lines often shown between the box and the data points within 1.5 IQR of the nearer quartile). N.B. several variants of box plots exist; authors are often poor at documenting the precise rules used by their software.

The popularity of the box plot has its price. Box plots can be very useful for showing the gross features of many groups or variables (say 20 or 30, sometimes even more). As commonly used for comparing say 2 or 3 groups they are oversold, in my view, as other plots can show much more detail intelligibly in the same space. Naturally, this is widely if not universally appreciated, and various enhancements of the box plot show more detail.

This is broad brush, and more details could be added. For example, the position of the median within the box sometimes gives a little more information.

UPDATE

I guess that many more people are interested in the uses (and limitations) of box plots in general than in the specific question of inferring variance from a box plot (to which the short answer is "You can't, except indirectly, approximately, and sometimes"), so I will add yet further comments on alternatives, as prompted by @Christian Sauer.

• Histograms used sensibly are often still competitive. The modern classic introductory text by Freedman, Pisani and Purves uses them throughout.

• What are various known as dot or strip plots (charts) (and by many other names) are easy to understand. Identical points can be stacked, after binning if desired. You can add median and quartiles, or mean and confidence intervals, to your heart's content.

• Quantile plots are, it seems, an acquired taste but in several ways most versatile of all. I include here plots of ordered values again cumulative probability (plotting position) as well as quantile plots that would be straight if the data were any "brand-name" distribution being considered (normal, exponential, gamma, whatever). (Acknowledgments to @Scortchi for the reference to "brand-name" as used by C.J. Geyer.)

But a comprehensive list is not possible. (I'll add, for example, that very occasionally, a stem-and-leaf representation is exactly right to see important detail in data, as when digit preference is rampant.) The key principle is that the best kinds of distribution plot allow the seemingly impossible, perception of fine structure in data that could be interesting or important (modality, granularity, outliers, etc.) as well as coarse structure (level, spread, skewness, etc.).

Box plots are not equally good at showing all kinds of structure. They cannot be, and were not intended to be. It is worth flagging that J.W. Tukey in Exploratory data analysis Reading, MA: Addison-Wesley (1977) gave an example of bimodal data from Rayleigh which a box plot obscures the main structure completely. As a great statistician, he was well aware that box plots were not always the answer.

A bizarre practice, widespread in introductory texts, is discussing ANOVA while inviting readers to look at box plots, which show medians and quartiles, not means and variances (rather SDs). Naturally, looking at the data is much better than not looking, but even so, a more appropriate graphical representation is arguably some plot of the raw data with fitted means +/- some appropriate multiple of SE.

-
Nick, could you describe the alternatives to box-plots for a small number of variables? – Christian Sauer Mar 28 '14 at 7:49
@ChristianSauer Thanks for the prompt: please see update. – Nick Cox Mar 28 '14 at 9:43
Thank you for the very nice update. I especially like your last paragraph, I find box-plots coupled with ANOVA and / or regression quite confusing - it's like comparing apples and oranges. – Christian Sauer Mar 28 '14 at 11:35
Statistics, like just about any other science, is full of bizarre terminology, notation, and analysis habits just copied from others. – Nick Cox Mar 28 '14 at 12:22
I totally agree - in my master's thesis I checked independed Variables for their normal distribution...that's the finest form of cargo cult statistics :( – Christian Sauer Mar 28 '14 at 13:54

A naive approach:

In a Normal distribution, the 25% and 75% quantiles are located at $0.67\cdot\sigma$ distance from the center. That gives that the 50% centered density covers twice this distance ($1.35\cdot \sigma$). In a boxplot, the intequartile Range (IQR, the distance from the bottom of the box to the top) covers the 50% centered amount of sample.

If you make the assumption that your population follows a Normal distribution (which sometimes is a BIG assumption to do, not so trivial), then the standard deviation of your population could be roughly estimated from the equation $IQR=1.35\cdot\sigma$, that is $\sigma=0.74\cdot IQR$.

And about comparing variances by boxplot: wider boxes mean bigger variances, but that gives you exploratory understanding, and you have to take into account also whiskers and outliers. For confirmation you should use hypothesis contrast.

-
To compare the variance we have still to suppose both the distribution are normal? Can we deduce that the variable is normal if the box is symmetric respect to the center? – Donbeo Mar 27 '14 at 11:49
I subscribe everything @Nick_Stauner says. What I exposed was assuming that your populations are Normal, which requires, among others but not just, symmetry and kurtosis = 0. This assumption is violated frequently. – Rufo Mar 27 '14 at 12:07
Kurtosis is defined in various ways. On another (simpler) definition, a normal (Gaussian) has kurtosis 3. You need to check which definition your software uses if you are computing it in practice. – Nick Cox Mar 27 '14 at 12:25
For a normal distribution, that would be kurtosis 3, excess kurtosis 0, if I'm not mistaken. I'm curious if any popular software packages produce non-excess kurtosis by default. That would probably produce a lot of confusion (not to deny that people in general are somewhat confused by the omission of "excess" in the opposite practice)... – Nick Stauner Mar 27 '14 at 12:29
Stata produces kurtosis by default. "Excess kurtosis" is a horrible term in my view, but beyond eradication. Kurtosis as most simply defined in term of second and fourth moments has much nicer properties than (kurtosis $-$ 3); use of the last definition can be attributed to excessive veneration of the normal distribution as being somehow the "normal" (all puns intended) from which other distributions deviate. We should have a broader view of what distributions are possible and natural. – Nick Cox Mar 27 '14 at 12:48