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?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
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:
Looks pretty similar, right? Yet $\sigma^2_1=1,\sigma^2_2=1.96$!
In case it's not clear from the code, population
And no, you cannot deduce that this population is normal just because it's exactly symmetrical. Here's a Q-Q plot of population
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
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.
Serious work with variances requires access to original data.
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.
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.
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.
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.