Measures of Center and Spread

The numbers that summarize a distribution. The mean, median and mode, with proofs that the mean minimizes squared deviations and the median absolute ones; their behavior under skewness and a single recording error; the range, interquartile range, variance and standard deviation, worked by hand on eleven NHANES blood pressures; why software disagrees about quartiles; z-scores, the empirical rule checked against heights and blood pressures, and Chebyshev's inequality proved; grouped data, changes of units, and which summaries to report.

The systolic blood pressures of the 5,247 adults in the National Health and Nutrition Examination Survey (NHANES) of 2017 to 2018 have a mean of 126.36 mm Hg and a median of 123.33. Their standard deviation is 20.12 and their interquartile range is 24.67. A histogram shows the whole distribution, but a report often has room for two numbers. Which two should it give, and why do the candidates disagree?

The usual two answer two questions. "About how large are the values?" is answered by a measure of center (or location). "How much do they vary?" is answered by a measure of spread (or scale, or dispersion). Each question has several reasonable answers, and each answer is sensitive to different features of the data. This article is the course's home for these summaries. Later units, such as Sampling Distributions, use them without defining them again.

First we define the mean, median and mode on a hand-sized sample of eleven adults, and prove what makes the mean and the median best. Then we watch them separate under skewness and a recording error. Next come the measures of spread. Finally we use the standard deviation as a ruler, test the empirical rule on real data, prove Chebyshev's inequality, and say what to report.

The notation is that of the course:

  • $x_1, \ldots, x_n$ for a sample of $n$ values;
  • $\bar{x}$ for the sample mean and $s$ for the sample standard deviation;
  • Greek letters $\mu$ and $\sigma$ for the mean and standard deviation of a population.

A sample of eleven

The script draws 11 adults at random from the 5,247 (seed 11). Their mean systolic pressures, rounded to one decimal and analyzed as rounded, are, in the order drawn,

$$98.0,\ 120.0,\ 119.3,\ 156.7,\ 170.7,\ 136.0,\ 147.3,\ 102.0,\ 112.0,\ 124.0,\ 106.0,$$

and in increasing order,

$$98.0,\ 102.0,\ 106.0,\ 112.0,\ 119.3,\ 120.0,\ 124.0,\ 136.0,\ 147.3,\ 156.7,\ 170.7.$$

The sorted values are the order statistics, written $x_{(1)} \le x_{(2)} \le \cdots \le x_{(n)}$. Here $x_{(1)} = 98.0$ and $x_{(11)} = 170.7$.

Measures of center

The mean

The mean is the sum of the values divided by their number:

$$\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i.$$

For the eleven adults the sum is 1,392.0, and $\bar{x} = 1392.0/11 = 126.55$ mm Hg. For a whole population of $N$ values, the same formula gives the population mean $\mu$. For the 5,247 adults, $\mu = 126.36$.

The mean has a physical picture: it is the balance point of the values placed as equal weights on a number line. The algebraic form of that statement is that the deviations from the mean, $x_i - \bar{x}$, sum to zero:

$$\sum_{i=1}^{n}(x_i - \bar{x}) = \sum_{i=1}^{n} x_i - n\bar{x} = n\bar{x} - n\bar{x} = 0.$$

For the eleven adults, the deviations in the order drawn are $-28.55$, $-6.55$, $-7.25$, $30.15$, $44.15$, $9.45$, $20.75$, $-24.55$, $-14.55$, $-2.55$ and $-20.55$. They add to zero, up to rounding.

Why is the mean the natural center? Suppose we summarize the data by a single number $c$, and measure the loss by the sum of squared deviations $\sum (x_i - c)^2$. The idea in one sentence: moving $c$ away from $\bar{x}$ adds a penalty that grows with the square of the distance, and the cross term that might offset it vanishes because deviations from the mean sum to zero.

Proposition 1. For any number $c$,

$$\sum_{i=1}^{n}(x_i - c)^2 = \sum_{i=1}^{n}(x_i - \bar{x})^2 + n(\bar{x} - c)^2,$$

so the sum of squared deviations is smallest, uniquely, at $c = \bar{x}$.

Proof. Write $x_i - c = (x_i - \bar{x}) + (\bar{x} - c)$ and square:

$$\sum (x_i - c)^2 = \sum (x_i - \bar{x})^2 + 2(\bar{x} - c)\sum (x_i - \bar{x}) + n(\bar{x} - c)^2.$$

The middle sum is zero by the previous identity. The last term is never negative, and is zero only when $c = \bar{x}$. $\square$

The same identity reappears in two later places. It is the decomposition of variation in one-way analysis of variance, and the reason the least-squares line passes through the point of means in Simple Linear Regression.

The median

The median is the middle value of the ordered data: half the values are at or below it and half at or above. For $n$ values,

$$\text{median} = \begin{cases} x_{((n+1)/2)} & n \text{ odd,} \\[4pt] \tfrac{1}{2}\left(x_{(n/2)} + x_{(n/2+1)}\right) & n \text{ even,} \end{cases}$$

the definition given in the NIST/SEMATECH e-Handbook (§1.3.5.1). For the eleven adults, the median is the sixth ordered value, $x_{(6)} = 120.0$ mm Hg. A twelfth adult drawn by the script (seed 12) has a pressure of 106.7. With $n = 12$, the median is the average of the sixth and seventh ordered values, $(119.3 + 120.0)/2 = 119.65$.

The median plays the same role for absolute deviations that the mean plays for squared ones. The plan of the proof: the sum of absolute deviations is a broken line in $c$. Its slope at any point counts the values below $c$ minus the values above, so it falls while fewer than half the values are below $c$ and rises after.

Proposition 2. The sum of absolute deviations $\sum |x_i - c|$ is smallest when $c$ is a median.

Proof. Let $D(c) = \sum |x_i - c|$. It is continuous in $c$, and between two neighboring order statistics it is a straight line.

Take an open interval that contains no data value, with $b$ values below it and $a = n - b$ above. Moving $c$ to the right by $\delta$, while staying in the interval, takes each of the $b$ values $\delta$ farther away and brings each of the $a$ values $\delta$ closer. So $D$ changes by $(b - a)\delta$, and the slope there is $b - a = 2b - n$. The slope is negative while $b < n/2$ and positive once $b > n/2$, and it can only increase as $c$ passes data values.

For odd $n$, the slope is negative to the left of $x_{((n+1)/2)}$ and positive to its right, so $D$ is smallest exactly at that middle value. For even $n$, the slope is negative to the left of $x_{(n/2)}$, zero between $x_{(n/2)}$ and $x_{(n/2+1)}$, and positive to the right of $x_{(n/2+1)}$. So $D$ takes its smallest value at every point of that interval, which includes the median. $\square$

For the eleven adults (tick marks), the sum of squared deviations from a candidate center c (left) is a parabola with its minimum at the mean, 126.5 mm Hg; the sum of absolute deviations (right) is a broken line with its minimum at the median, 120.0. Notice that the two minimums fall in different places: the two summaries are optimal for different measures of error.
For the eleven adults (tick marks), the sum of squared deviations from a candidate center c (left) is a parabola with its minimum at the mean, 126.5 mm Hg; the sum of absolute deviations (right) is a broken line with its minimum at the median, 120.0. Notice that the two minimums fall in different places: the two summaries are optimal for different measures of error.

The check on the eleven adults agrees. At the mean, the sum of squared deviations is 5,531.89; at the median it is 6,003.16. At the median, the sum of absolute deviations is 197.40; at the mean it is 209.04. Neither center is better in general. They answer different questions, and the difference matters most when the data are skewed or contain errors.

The mode

The mode is the most frequent value. It is the only measure of center for nominal data, such as the commonest category of race and Hispanic origin in Types of Numerical Data. It is also natural for counts: the most common household size among the NHANES adults is 2 people.

For continuous data, the mode of the raw values is fragile. The commonest single systolic value among the 5,247 adults is 125.33 mm Hg, shared by 92 people. It is closely followed by 114.0 and 116.67, with 89 each. Those counts mostly reflect which averages of even readings are possible. The NIST/SEMATECH handbook (§1.3.5.1) suggests the midpoint of the tallest histogram class as a more meaningful mode for continuous data. With classes of 10 mm Hg, the modal class is 110 to 120.

The word is used more loosely for the peaks of a histogram. A distribution with one peak is unimodal, and one with two is bimodal, often a sign that two different groups have been mixed.

Skewness and the choice of center

For the eleven adults, the mean (126.55) is above the median (120.0). For all 5,247 it is too (126.36 against 123.33). Is that a coincidence?

In a sample of eleven it could be, but for the whole survey it is not. In a symmetric distribution the mean and the median coincide. In a skewed one they separate, and the mean moves toward the long tail. The mean is affected by how far out the extreme values are, while the median is affected only by which side of the middle they are on.

Top: heights of 2,517 men, nearly symmetric; mean (solid) and median (dashed) are 173.5 cm, and the dotted lines one and two standard deviations either side hold 68.7% and 95.0% of the men. Bottom: systolic pressures of 5,247 adults, skewed to the right. Notice that here the mean, 126.4 mm Hg, lies to the right of the median, 123.3, pulled toward the long tail.
Top: heights of 2,517 men, nearly symmetric; mean (solid) and median (dashed) are 173.5 cm, and the dotted lines one and two standard deviations either side hold 68.7% and 95.0% of the men. Bottom: systolic pressures of 5,247 adults, skewed to the right. Notice that here the mean, 126.4 mm Hg, lies to the right of the median, 123.3, pulled toward the long tail.
Variable $N$ Mean Median 10% trimmed mean Skewness $g_1$
Height of men (cm) 2,517 173.53 173.50 173.52 0.005
Systolic pressure (mm Hg) 5,247 126.36 123.33 124.48 1.038
BMI (kg/m²) 5,176 29.67 28.40 28.97 1.206

The skewness in the table is the Fisher–Pearson coefficient,

$$g_1 = \frac{\frac{1}{N}\sum (x_i - \bar{x})^3}{s_N^3},$$

where $s_N$ is the standard deviation computed with divisor $N$ (NIST/SEMATECH, §1.3.5.11). Cubing the deviations keeps their signs and magnifies the large ones. So a long right tail gives a positive value, and a symmetric distribution a value near zero.

A trimmed mean drops a fixed share of the smallest and largest values before averaging; the 10% trimmed mean drops 10% at each end. It keeps most of the mean's use of the data while ignoring the tails (NIST/SEMATECH, §1.3.5.1). For the skewed variables it falls between the mean and the median.

Which center to report depends on the question. For blood pressure, the median describes the typical adult better: half the adults are below 123.33, and the mean is pulled up by a minority with very high pressures. The mean answers a different question. It is the total divided by the number of people, the quantity that matters for anything that adds up over a population, such as total doses or total costs. It is also the quantity that the sampling theory of the sampling distribution of the mean and the $t$ methods of later units estimate.

A rule with exceptions

A rule often taught with these pictures says that the mean lies on the side of the median toward the longer tail. It holds for these three variables, and it usually holds for continuous data, but it is a tendency rather than a theorem. Von Hippel (2005) collected violations. He found them most often in discrete data, where many values coincide with the median and the shares on either side of it are unequal. They occur occasionally in continuous data with several peaks, or with one long tail and one heavy one.

Skewness itself can be measured in more than one way. Galton's (or Bowley's) measure, $(Q_1 + Q_3 - 2\,\text{median})/(Q_3 - Q_1)$, uses only the quartiles (NIST/SEMATECH, §1.3.5.11). For household size, whose quartiles are 2 and 4 around a median of 3, it is exactly 0, while $g_1 = 0.656$ reflects the long tail of large households.

Resistance to errors

Skewness pulls the mean a few mm Hg from the median. A recording error can pull it much farther. Suppose the largest of the eleven pressures, 170.7, is entered as 1707.0, a slip of the decimal point.

Check your understanding. Before reading the table, predict which of these six summaries will change: mean, median, trimmed mean, standard deviation, interquartile range, range.

Summary Correct data With the error
Mean 126.55 266.21
Median 120.00 120.00
Trimmed mean (one value dropped at each end) 124.81 124.81
Standard deviation 23.52 478.21
Interquartile range 32.65 32.65
Range 72.7 1609.0

The mean, the standard deviation and the range move; the other three do not. One bad value more than doubles the mean and multiplies the standard deviation by twenty. The median, the trimmed mean and the interquartile range stay where they were. The trimmed mean drops the bad value, and the other two never look at how far out the largest value is.

A summary that a small share of wild values cannot carry arbitrarily far is called resistant (or robust). The mean can be moved anywhere by changing a single value. The median stays within the range of the good data as long as fewer than half the values are bad.

This is a reason to compute both kinds of summary when data are first examined. A large gap between the mean and the median, or between the standard deviation and what the interquartile range suggests, is often the first sign of an error, as well as of skewness.

The same tension, between using every value and resisting wild ones, runs through the measures of spread.

Measures of spread

Range

The range is the largest value minus the smallest. For the eleven adults it is $170.7 - 98.0 = 72.7$ mm Hg. It is easy to compute and to explain. But it depends on only two values, the two most likely to be unusual.

It also grows with the sample size, because a larger sample reaches further into the tails. The script drew 30 samples of each size from the 5,247 adults, with replacement. The table reports the median of the 30 values, with the middle half of them in parentheses:

Sample size Range Interquartile range Standard deviation
10 70.7 (52.8 to 78.0) 19.75 (17.88 to 25.54) 21.70 (15.92 to 24.44)
100 98.7 (89.2 to 111.2) 23.25 (21.08 to 25.75) 20.33 (18.71 to 21.14)
1,000 144.7 (130.7 to 150.7) 24.67 (24.00 to 25.33) 20.30 (19.66 to 20.81)
Population (5,247) 165.3 24.67 20.12

The range doubles between samples of 10 and of 1,000, while the other two measures settle near their population values. Ranges from samples of different sizes cannot be compared, and a range from a sample is a poor estimate of anything about the population.

Check your understanding. If the script drew samples of 100,000 from the 5,247 adults, with replacement, could the sample range exceed 165.3 mm Hg?

No. Every value drawn is one of the 5,247 pressures, so the sample range can only approach the population's own, 165.3.

Quartiles and the interquartile range

The quartiles split the ordered data into four parts with equal counts. The first quartile $Q_1$ has a quarter of the data below it, the median is the second quartile, and the third quartile $Q_3$ has three quarters below it. More generally, the $p$th percentile has (about) $p\%$ of the data below it.

The interquartile range $\mathrm{IQR} = Q_3 - Q_1$ is the width of the middle half of the data. Like the median, it is resistant, and it is the measure of spread that goes with the median in the box plots of Tables and Graphs for Data.

Why software disagrees about quartiles

Unlike the median, a quartile has no single agreed definition for a sample. With 11 values, the first quartile should have "a quarter of 11", 2.75 values, below it, and there are several defensible ways to land between data points.

The NIST/SEMATECH handbook (§7.2.6.2) explains its own default. It sets $p(n+1) = k + d$, with $k$ an integer and $0 \le d < 1$, and interpolates a share $d$ of the way from $x_{(k)}$ to $x_{(k+1)}$. For the eleven adults and $p = 0.25$, $p(n+1) = 3$, so $Q_1 = x_{(3)} = 106.0$. For $p = 0.75$, $p(n+1) = 9$, so $Q_3 = x_{(9)} = 147.3$.

The handbook then lists the alternatives in common use, referring to Hyndman and Fan's (1996) survey of nine methods in statistical software. NumPy's percentile computes types 6, 7 and 8 as its methods weibull, linear and median_unbiased (NumPy, percentile). The common methods give, for the same eleven values:

Method $Q_1$ $Q_3$ IQR
$p(n+1)$, the NIST default (Hyndman–Fan type 6) 106.000 147.300 41.300
$1 + p(n-1)$, the default of R, Excel and NumPy's percentile (type 7) 109.000 141.650 32.650
$p(n + 1/3) + 1/3$, recommended by Hyndman and Fan (type 8) 107.000 145.417 38.417
Medians of the lower and upper halves, median excluded 106.000 147.300 41.300
Medians of the halves, median included (Tukey's hinges) 109.000 141.650 32.650

The type 7 calculation, for instance, sets $1 + 0.25 \times 10 = 3.5$, halfway between $x_{(3)} = 106.0$ and $x_{(4)} = 112.0$, giving 109.0. It sets $1 + 0.75 \times 10 = 8.5$, halfway between $x_{(8)} = 136.0$ and $x_{(9)} = 147.3$, giving 141.65. With twelve values (adding 106.7) the methods spread differently. The type 6, 7 and 8 values of $Q_1$ are 106.175, 106.525 and 106.292, and both "halves" methods give 106.35.

For small samples these differences are large: the IQR of the eleven values is 32.65 by one method and 41.30 by another.

Check your understanding. Would the methods disagree as much for all 5,247 adults?

No. For a large sample, every method lands between the same two neighboring order statistics. For the 5,247 adults, whose pressures have many tied values, every method in the table gives exactly 112.0 and 136.67.

The practical rule is to know which method a program uses, and to state it when the sample is small. The NIST handbook judges types 6, 7 and 8 all acceptable for most purposes.

Variance and standard deviation

The range and the IQR use two values each. Can a measure of spread use every value, the way the mean does for center? It would start from the deviations $x_i - \bar{x}$. Their sum is always zero, so they cannot simply be averaged; squaring them removes the signs. The sample variance is

$$s^2 = \frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar{x})^2,$$

and the sample standard deviation is its square root, $s = \sqrt{s^2}$, which is in the units of the data.

For the eleven adults, the squared deviations in the order drawn are 814.84, 42.84, 52.50, 909.30, 1,949.62, 89.39, 430.75, 602.48, 211.57, 6.48 and 422.12. Their sum is 5,531.89, so

$$s^2 = \frac{5531.89}{10} = 553.19 \text{ (mm Hg)}^2, \qquad s = \sqrt{553.19} = 23.52 \text{ mm Hg}.$$

The same sum can be computed without the deviations, from $\sum (x_i - \bar{x})^2 = \sum x_i^2 - n\bar{x}^2$. (Expand the square and use $\sum x_i = n\bar{x}$.) Here $181{,}683.16 - 176{,}151.27 = 5{,}531.89$. The shortcut was useful for hand calculation. In floating-point arithmetic, though, it subtracts two large, nearly equal numbers and can lose accuracy, so software uses the deviations.

Why divide by $n - 1$? The divisor is $n - 1$, not $n$, and two reasons point the same way.

  • The deviations from $\bar{x}$ satisfy one constraint: they sum to zero. So only $n - 1$ of them are free to vary. Once ten are known, the eleventh is determined. These are the degrees of freedom of $s^2$.
  • Dividing by $n - 1$ makes $s^2$ an unbiased estimate of the population variance, as Confidence Intervals for a Mean: z and t proves. Dividing by $n$ underestimates it on average by the factor $(n-1)/n$. The deviations are measured from the sample's own mean, which is closer to the sample than the population mean is.

With divisor $n$, the eleven adults give a variance of 502.90 and a standard deviation of 22.43.

For a whole population of $N$ values, nothing is being estimated, and the population variance and standard deviation divide by $N$:

$$\sigma^2 = \frac{1}{N}\sum_{i=1}^{N}(x_i - \mu)^2.$$

For the 5,247 adults, $\sigma = 20.12$ mm Hg. With divisor $N - 1$ it would be 20.127, a difference invisible at this size.

Check your understanding. Adding the twelfth adult, at 106.7 mm Hg, lowers the mean from 126.55 to 124.89. Does the standard deviation go up or down?

Down, from 23.52 to 23.15. Adding a value $x$ to $n$ others lowers the standard deviation exactly when $|x - \bar{x}| < s\sqrt{(n+1)/n}$, that is, when the new value lies roughly within one standard deviation of the old mean. Here 106.7 lies inside $126.55 \pm 23.52$.

Other typical distances

The standard deviation is roughly the typical distance of a value from the mean, but it weights large deviations heavily. A value 20 mm Hg from the mean adds 400 to the sum of squares; one 40 away adds 1,600 (NIST/SEMATECH, §1.3.5.6). That is why one recording error inflated it twentyfold above. Two other measures of the typical distance avoid the squaring (NIST/SEMATECH, §1.3.5.6).

  • The mean absolute deviation, $\frac{1}{n}\sum |x_i - \bar{x}|$, weights each deviation by its size rather than its square. It is 19.00 for the eleven adults. It is less dominated by one large deviation than the standard deviation, but a single wild value can still move it without limit.
  • The median absolute deviation (MAD), the median of $|x_i - \text{median}|$, is resistant in the sense of the previous section. It is 16.00 for the eleven adults.

The coefficient of variation

The standard deviation is in the units of the data, so it cannot compare the variability of quantities measured in different units. The coefficient of variation divides it by the mean, $\mathrm{CV} = s/\bar{x}$ (or $\sigma/\mu$), giving a unitless ratio.

Among the NHANES adults, the CV is 0.044 for men's height, 0.159 for systolic pressure and 0.249 for BMI. Relative to their averages, heights vary little and BMI varies most. The CV needs a meaningful zero, which is why Types of Numerical Data lists it among the statistics of ratio scales.

Changes of units

What happens to all these summaries when the units change? If every value is transformed by $y_i = a + b x_i$:

  • the mean, median and quartiles transform the same way, $\bar{y} = a + b\bar{x}$;
  • measures of spread ignore the shift and scale by $|b|$: $s_y = |b|\,s_x$ and $s_y^2 = b^2 s_x^2$.

Both facts follow directly from the definitions, since $y_i - \bar{y} = b(x_i - \bar{x})$.

Check your understanding. The NHANES pressures are converted from mm Hg to kilopascals, multiplying by 0.133322. What happens to the coefficient of variation?

Nothing. The mean and the standard deviation are both multiplied by 0.133322, so their ratio is unchanged. The script gives a mean of 16.847 kPa, a median of 16.443 kPa and a standard deviation of 2.683 kPa, each 0.133322 times its value in mm Hg, and a coefficient of variation of 0.1593 in both units.

Standard deviations as a ruler

z-scores

Shifting by the mean and dividing by the standard deviation expresses a value as a number of standard deviations from the mean, its z-score:

$$z = \frac{x - \bar{x}}{s} \quad\text{(or } (x - \mu)/\sigma \text{ for a population).}$$

By the rules for changes of units, z-scores have mean 0 and standard deviation 1. A systolic pressure of 180 mm Hg has $z = (180 - 126.36)/20.12 = 2.665$ among the 5,247 adults. A man 190 cm tall has $z = 2.143$ among the men. The z-score makes values from different distributions comparable in the sense of "how unusual". It is the standardization that The Normal Distribution uses to reduce every normal distribution to one table.

Check your understanding. The man on the first line of Types of Numerical Data is 185.0 cm tall. Is he more or less unusual among men than a systolic pressure of 180 is among all adults?

Less. His height has $z = 1.492$, about one and a half standard deviations above the men's mean, while the pressure is 2.665 standard deviations above the adults' mean.

The empirical rule

For data whose histogram is close to a normal curve, the empirical rule says that about 68% of the values lie within one standard deviation of the mean, about 95% within two, and about 99.7% within three. The exact normal shares are 0.6827, 0.9545 and 0.9973. The rule is a property of the normal distribution. It describes other data only as well as the normal curve describes them.

Check your understanding. The blood pressures are skewed to the right, with a peak between 110 and 125 mm Hg and a long upper tail. Will more or fewer than 68% of them lie within one standard deviation of the mean?

More: 70.92%. The few values far out in the tail add large squared deviations, so they inflate the standard deviation. The one-standard-deviation band is then wide compared with the bulk of the data, and it holds more of the bulk than the normal curve's 68%. This is a tendency of long-tailed data rather than a rule, and BMI in the table below shows it too.

Within $k$ standard deviations of the mean $k = 1$ $k = 2$ $k = 3$
Normal distribution 0.6827 0.9545 0.9973
Height of men 0.6869 0.9503 0.9984
Systolic pressure 0.7092 0.9537 0.9886
BMI 0.7307 0.9585 0.9869
Household size 0.6484 0.9552 1.0000
Chebyshev's guarantee, any data at least 0 at least 0.75 at least 0.8889

Men's heights follow the rule closely. The skewed variables have too many values within one standard deviation, about the right share within two, and too many beyond three. For example, 1.14% of the blood pressures are more than three standard deviations from the mean, 4.24 times the normal share of 0.27%. Household size, with only seven possible values, matches at two standard deviations by coincidence.

The rule is therefore a useful description of roughly normal data and a weak test of normality. Agreement at two standard deviations says little, and the shape is better judged from a histogram or a normal probability plot.

Chebyshev's inequality

The last row of the table holds for data of any shape. The idea in one sentence: values far from the mean contribute large squared deviations, and the variance is a fixed total, so not many values can be far away.

Proposition 3 (Chebyshev's inequality). In any population of $N$ values with mean $\mu$ and standard deviation $\sigma > 0$, and for any $k > 0$, the share of values at least $k\sigma$ from the mean is at most $1/k^2$.

Proof. Let $m$ be the number of values with $|x_i - \mu| \ge k\sigma$. Every term of the variance is nonnegative, so dropping the terms of the other values can only decrease the sum. Each remaining term is at least $k^2\sigma^2$:

$$\sigma^2 = \frac{1}{N}\sum_{i=1}^{N}(x_i - \mu)^2 \ \ge\ \frac{1}{N}\sum_{|x_i - \mu| \ge k\sigma}(x_i - \mu)^2 \ \ge\ \frac{m}{N}\,k^2\sigma^2.$$

Dividing by $k^2\sigma^2$ gives $m/N \le 1/k^2$. $\square$

So at least $1 - 1/k^2$ of any data lie within $k$ standard deviations of the mean: at least 75% within two, and at least 88.9% within three. The same holds for a sample with its standard deviation computed either way. The standard deviation $s$ with divisor $n - 1$ is slightly larger than with divisor $n$, which only widens the interval.

The check on the NHANES data is easy: every variable in the table clears Chebyshev's bound by a wide margin, the blood pressures with 95.37% within two standard deviations against the guaranteed 75%. The bound is far below what roughly normal data achieve. That is the price of assuming nothing about shape, and for $k \le 1$ it says nothing at all. It is what makes the standard deviation meaningful for every distribution, not only normal ones.

Summaries from a frequency table

Everything so far has used the individual values. Many published reports give only a frequency table. Can the mean and standard deviation be recovered from it?

Approximately. Treat every value in a class as if it were at the class midpoint $m_j$. With class frequencies $f_j$ and $n = \sum f_j$,

$$\bar{x} \approx \frac{\sum_j f_j m_j}{n}, \qquad s^2 \approx \frac{\sum_j f_j (m_j - \bar{x})^2}{n - 1}.$$

The first is a weighted mean, with the frequencies as weights.

Check your understanding. The blood pressure distribution declines to the right of its peak. Will the grouped mean, computed from the 10 mm Hg frequency table, come out above or below the exact mean?

Above. In a declining tail, more of each class's values sit near its lower end, so the midpoint overstates them. Applied to the frequency table of Tables and Graphs for Data, the formulas give a mean of 126.68 mm Hg and a standard deviation of 20.35, against the exact 126.36 and 20.13 from the individual values. The values in a class sit, on average, 0.32 mm Hg below its midpoint, which is exactly the gap between the two means. The tail argument accounts for the largest part: in the classes from 140 up the values sit 0.83 mm Hg below their midpoints. Below 140, where the argument does not apply to the classes rising toward the peak, the script still finds a smaller offset of 0.18 mm Hg in the same direction, so the tail is not the whole story.

Grouping also inflates the variance slightly. A classical adjustment, Sheppard's correction, subtracts $h^2/12$ from the grouped variance for classes of equal width $h$. It is derived for a smooth distribution that tapers off at both ends, with classes narrow compared with its spread. Here $h^2/12 = 100/12 = 8.33$, and the corrected standard deviation is 20.15, close to the exact 20.13. A median and quartiles can be read from the cumulative column of the table by interpolating within a class, with similar small errors.

What to report

  • For a roughly symmetric distribution without outliers, report the mean and the standard deviation. Together with the empirical rule they describe the data well.
  • For a skewed distribution, or data with outliers, report the median and the interquartile range, often as the five-number summary (minimum, $Q_1$, median, $Q_3$, maximum). Reporting the mean as well is useful when totals matter.
  • For ordinal data, report the median and quartiles, or the full table of shares. For nominal data, report the table of shares.
  • State $n$, the units and, for small samples, how quartiles were computed.

The mean and the standard deviation remain the summaries that inference is built on, even for skewed data. The behavior of a sample mean is known whatever the shape of the population (the central limit theorem). The choice of descriptive summary and the choice of inferential method are related but separate decisions.

Corrections to the course notes

The unit's notes give the variance in one place as $\sum (x - \bar{x})^2/n$ and in another as $s^2 = \sum (x_i - \bar{x})^2/(n-1)$. Both are correct for different purposes: divisor $N$ for the variance of a complete population, $\sigma^2$, and divisor $n - 1$ for the sample variance $s^2$ that estimates it, as above. The notes also describe the empirical rule as a quick check for normality. As the table shows, data can match the rule at two standard deviations while being clearly skewed, so the rule is better used as a description of data already known to be roughly normal.

What we have learned

The mean minimizes squared deviations and the median absolute ones. They agree for symmetric data such as men's heights, separate under the skew of blood pressure, and part completely when one value is misrecorded. Spread splits the same way. The standard deviation uses every value and is the ruler for z-scores, the empirical rule and Chebyshev's guarantee. The interquartile range resists wild values, but in small samples it depends on how software computes quartiles.

This completes the description of one population. The next unit compares populations of different sizes and age structures, beginning with Rates in Public Health.

In Python

Software disagrees about the default divisor of the standard deviation, which is worth knowing before any number is reported:

import numpy as np, pandas as pd, statistics

x = np.array([98.0, 120.0, 119.3, 156.7, 170.7, 136.0, 147.3, 102.0, 112.0, 124.0, 106.0])
x.std()                      # 22.4254  NumPy: divisor n (ddof=0) by default
x.std(ddof=1)                # 23.5200  divisor n - 1
pd.Series(x).std()           # 23.5200  pandas: divisor n - 1 by default
statistics.stdev(x)          # 23.5200  sample; statistics.pstdev(x) gives 22.4254
np.percentile(x, [25, 75])                     # [109.0, 141.65], type 7
np.percentile(x, [25, 75], method='weibull')   # [106.0, 147.3], type 6, the NIST default
pd.Series(x).describe()      # count, mean, std (n - 1), min, quartiles (type 7), max

Every number in this article is computed by tools/experiments/applied-statistics/measures-of-center-and-spread.py in the site's repository, and the figures are drawn by tools/figures/measures-of-center-and-spread.py from its output.

References