20
$\begingroup$

While doing some EDA I decided to use a box plot to illustrate the difference between two levels of a factor.

The way ggplot rendered the box plot was satisfactory, but slightly simplistic (first plot below). Whilst researching the characteristics of box plots I started experimenting with notches.

I understand notches display the CI around the median, and that if two boxes' notches don't overlap there's ‘strong evidence’ – at a 95% confidence level – that the medians differ.

In my case (second plot), the notches don't meaningfully overlap. But why does the bottom of the box on the right hand side take that strange form?

Plotting the same data in a violin plot didn't indicate anything unusual about the probability density of the corresponding violin.

fig.1 boxplot

fig.2 notched boxplot

$\endgroup$
3
  • 1
    $\begingroup$ In your ggplot code you should use fill=factor(am) since currently am is being used as a numeric variable. $\endgroup$
    – rnso
    Commented May 11, 2015 at 17:41
  • $\begingroup$ That's a great spot @rnso $\endgroup$
    – RDJ
    Commented May 11, 2015 at 18:30
  • $\begingroup$ Can anyone post the original data? I guess they are from a standard sand box for ggplot2. I like the idea of plotting the individual data points too but it's frustrated in so far as points within the dark box are made invisible. $\endgroup$
    – Nick Cox
    Commented Mar 4, 2020 at 16:51

1 Answer 1

22
$\begingroup$

In my case (second plot), the notches don't meaningfully overlap. But why does the bottom of the box on the right hand side take that strange form? How do I explain that?

It indicates that the 25th percentile is about 21, 75th percentile about 30.5. And the lower and upper limits of the notch are about 18 and 27.

A common reason is that your distribution is skewed or sample size is low. The notch's boundary is based on:

$median \pm 1.57 \times \frac{IQR}{\sqrt{n}}$

If the distance between median and the 25th percentile and the distance between median and the 75th percentile are extremely different (like the one at the right) and/or the sample size is low, the notch will be wider. If it's wide enough that the notch boundary is more extreme than the 25th and 75th percentiles (aka, the box), then the notched box plot will display this "inside out" shape.

$\endgroup$
2
  • 1
    $\begingroup$ Thanks a lot for your detailed explanation. Let me ask, why the lower and upper limits of the notch is about 17 and 24, not about 18 and 27 (on the right boxplot)? $\endgroup$
    – Denis
    Commented Feb 20, 2020 at 18:04
  • $\begingroup$ @Denis, Thanks for catching that. I have revised it. $\endgroup$ Commented Mar 4, 2020 at 15:09

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.