A local animal shelter tracks how long each cat naps during the slow afternoon hours — partly
for fun, partly because a cat who won’t settle down is harder to place with a family. Staff
watched 20 cats one afternoon and logged each nap in hours. Some numbers are unremarkable —
a little over an hour, a couple hours, four hours. Two cats, though, barely woke up: one
napped almost 9 hours, another over 10. If a volunteer asks “so how long does a cat nap here,
typically?” — what’s the honest answer? This week gives you the tools to answer that kind of
question for any batch of numbers: a single best “typical” value, a way to describe how
spread out the values are, and a way to tell when one or two values don’t behave like the rest.
When you’re staring at 20 numbers, the first thing you want is a single value that stands in
for “typical.” There are three common choices, and they don’t always agree.
Figure 1. A histogram of the 20 cats’ nap lengths shows most bars clustered between 1 and 5
hours, tallest around 2 hours, then a gap, then two lone bars sitting far to the right near 9
and 10 hours — a long right-hand tail with no matching tail on the left.
The mean (xˉ, “x-bar”) is the arithmetic average: add every value and divide by how
many there are.
xˉ=n∑xi
Here xi stands for each individual data value, ∑ (“sigma”) means “add them all up,” and
n is the number of observations (the sample size).
The median is the middle value once the data are sorted from smallest to largest (average
the two middle values if n is even). The mode is the most frequently occurring value. The
mode is most useful for categories or for numbers that repeat a lot, like whole-number ratings;
for finely measured data like the nap times below, it’s common for no two values to match
exactly, which just means the mode isn’t the right tool for that data set — not that you did
anything wrong.
2Measures of spread — range, IQR, variance, and standard deviation¶
Center alone can mislead you: two shelters could both report a “typical” nap of 2.6 hours, yet
one shelter’s cats might nap almost identically while the other’s vary wildly. You need a number
for spread, too.
The simplest is the range: max − min. More useful is the five-number summary — the
minimum, first quartile (Q1), median, third quartile (Q3), and maximum — where Q1 and
Q3 are the 25th and 75th percentiles (a percentile is the value below which a given
percentage of the data falls). The interquartile range, IQR=Q3−Q1, is the width of
the middle 50% of the data.
The sample variance measures the typical squared distance from the mean:
s2=n−1∑(xi−xˉ)2
and the sample standard deviations=s2 puts that back into the original units
(hours, minutes, dollars — whatever you started with), so it’s the number you’ll actually quote.
Look again at Example 1: the mean (3.47 hrs) sits well above the median (2.6 hrs). That’s not a
coincidence — when a distribution has a long right tail (a few unusually large values, like our
two marathon nappers), the mean gets pulled toward that tail while the median, which only cares
about position in the sorted list, barely moves. We call this a right-skewed distribution.
A left-skewed distribution has the opposite pattern (a long left tail, mean below median), and a
symmetric distribution has mean ≈ median. A distribution with one clear peak is
unimodal; two peaks, bimodal.
This matters because it tells you which summary to trust. A statistic is resistant (or
robust) if outliers barely change it. The median and IQR are resistant. The mean and standard
deviation are not — a single extreme value can drag them a long way. Here’s the effect,
directly measured.
Percentiles, one more time. Back in the cat data, 18 of the 20 cats napped 6 hours or less
(only the two outliers didn’t) — that’s 18/20=90%, so a 6-hour nap sits at roughly the
90th percentile of this group. Q1 is the 25th percentile and Q3 is the 75th, by
definition — the five-number summary is just three particular percentiles plus the extremes.
A different set of 8 classmates self-reported hours of sleep the night before an 8 a.m. class
(simulated data, sleep_hours_sim): 5.5, 6.0, 6.5, 7.0, 7.0, 7.5, 8.0, 9.5.
Find the mean and the median number of hours slept. Which one is larger, and by how much?
Describe the shape of this distribution (symmetric, or skewed — which direction?) and justify
your answer using the relationship between the mean and the median.
Find the five-number summary (min, Q1, median, Q3, max) and the IQR.
A classmate claims “the average student in this class slept about 9.5 hours.” Is that a fair
use of the word “average”? Explain your answer using one of the summary values from #1 or #3.
Using the 1.5·IQR rule and your answer to #3, find the lower and upper fences for this data
set. If a 9th student reported 13 hours of sleep, would that value be flagged as an outlier?
On your TI-83/84, which line of the 1-Var Stats output gives you the sample standard
deviation, and which column of R’s favstats() output gives you the same number?