Rob Slazas is back with some more Statistics goodness. Click on the link to see more of Rob’s work.

Matlab LogoFor those of us who consider ourselves “efficient thinkers” (outsiders might use the term “lazy”), here is a low-effort way of comparing the central tendencies between groups WITHOUT using any hypothesis test functions! I used a t-test in the last post to show that my mean long-jump was farther than Quan’s mean long-jump. Here we will get the same task done using a boxplot with the notch parameter. Let’s examine “notches” a little bit and then try an example.

Contents

Boxplot Bonus!

Have I mentioned that I really like boxplots? Well, one more reason to love them is found in the notch parameter. A notch is a V-shaped indentation in the box, centered on the median line. This feature is a quick way to decide if the medians in any two boxes are different from each other at the alpha = 5% significance level. If the notches overlap (looking horizontally across the boxes in the default orientation), they are not different. Separated notches are different. It’s that simple.

Notches

Looking at the figure above, I have put a blue shaded bar over the notched region of boxplot #1. Since the notched region of #1 overlaps the notch of #3, you can say with 95% confidence that the medians of #1 and #3 are not different. Also, since the bar does not overlap any part of the notch of #2, you can say with 95% confidence that medians #1 and #2 are different.

A Notched Example - Faster Cars

Since I’m an engineer, I like to break test things to see how they work. I want to know if a certain heat treatment will make the metal frame of my racecar stiffer (better handling). This will help me race Quan through the Hollywood hills. I happen to have an instrument that gives readings on the flexibility of metal in units called “flexons.” Since I want a stiffer frame, less “flexons” is better.

Race Car

Using a traditional 2-sample t-test, I would gather two sets of metal to test. The first set would be my control - I would do nothing but measure how many “flexons” it has. The second group would be my experimental group - I would perform my new heat treatment on it AND THEN measure its “flexons”. The MATLAB command would look like this (keeping the default of alpha = 0.05):

load flexons.mat;
[h,p,ci] = ttest2(control,heattreat)
h =
     1

p =
    0.0014

ci =
    8.6202
   33.9798

…Which you recall means that we reject H0 in favor of H1; little-p is much less than our alpha of 0.05, so we have reached statistical significance; and the average difference between the control and experimental groups is between 8.6 and 34 flexons.

…OR, instead of thinking too much about setting up the hypothesis test and interpreting the results, I could take the same two sets of data and graph them in a boxplot with the “notch” parameter turned on. Like so:

boxplot([control,heattreat],'notch','on','labels',{'controls';'heattreated'});

% dress up the plot a little bit (optional)
ylabel('Flexons');
title('Racecar Frame Flex Test');

Box Plot Bonus

Since the extents of the “V” shaped notches do not overlap each other, I can say with 95% confidence that the median flexibility after my new heat treatment is lower than without it! Lower “flexons” = stiffer frame = faster car = beating Quan to the bottom of the hill!

Wrapping Up

Hopefully this neat little feature comes in handy for you sometime. If there are others you know of and want to share, please post below in the comments. And as usual, your questions and other comments are welcome.