Descriptive statistics: centre and spread
Listen to this lesson
Every episode of this course is also a podcast: listen on Spotify.
This episode is a study companion for CompTIA Data+ DA0-002 and is not produced by or endorsed by CompTIA.
Why this matters
Most reported numbers are descriptive statistics: the average order value, the typical response time, the range of salaries. They summarise a column in one or two figures, and the choice of figure can make the same data tell different stories. An "average" order of £178 and a "typical" order of £99 can both be true of the same orders.
Data analysis carries the largest share of the Data+ exam, and descriptive statistics are its foundation. This lesson covers measures of centre and spread, percentiles and the five-number summary, how skew decides which measure to report, and why each is worth calculating by hand once.
The lesson
Mean, median and mode, and when each misleads
Three measures describe the centre of a set of values.
The mean is the sum divided by the count: what most people call the average. It uses every value, which makes it sensitive to extremes.
The median is the middle value when the data is sorted, or the average of the two middle values when the count is even. It depends only on order, so a few extreme values do not move it.
The mode is the most frequent value. It is the only one of the three that works for categories, such as the most common region, and a data set can have more than one mode or none.
Each misleads in its own way. The mean misleads when data is skewed or has outliers: in the course's practice orders, the mean order value is £177.58 and the median is £99.21, because a few very large orders pull the mean up. A report that says "the average order is £178" describes almost nobody. The median misleads when the shape matters, since it ignores how far the values spread. And the mode misleads for continuous data, where every value may be unique.
Survey scores show the reverse pattern. The practice survey's satisfaction scores, on a scale of 1 to 5, have a mean of 3.575, a median of 4 and a mode of 5. The single most common answer was the highest score, but a sizeable group of low scores pulls the mean down.
Range, variance and standard deviation
Measures of spread describe how far values are scattered, and two data sets with the same mean can have very different spreads.
The range is the maximum minus the minimum. It is simple and entirely determined by the two most extreme values, so a single outlier sets it. The practice order values run from £5.51 to £22,704, a range dominated by one wholesale order.
The variance is the average squared distance of values from the mean. Squaring makes all distances positive and weights large deviations more heavily. Its unit is the square of the data's unit, which makes it hard to interpret directly.
The standard deviation is the square root of the variance, which brings it back to the data's own unit. It is the most widely used measure of spread: in roughly normal data, most values lie within one standard deviation of the mean. The practice satisfaction scores have a standard deviation of about 1.35 points.
One distinction appears on exams. The population variance divides by the number of values, n. The sample variance, used when the data is a sample from a larger population, divides by n − 1, which corrects a tendency of samples to underestimate spread. Most analysis works with samples, and most tools default to the sample formula, though spreadsheets offer both, such as STDEV.S and STDEV.P in Excel.
Percentiles, quartiles and the five-number summary
A percentile is the value below which a given percentage of the data falls. The 90th percentile of response times is the time that 90% of responses beat. Percentiles are robust to outliers and describe position in a way averages cannot: service targets such as "95% of requests within 2 seconds" are percentile targets.
Quartiles divide sorted data into four equal parts. The first quartile (Q1) is the 25th percentile, the second (Q2) is the median, and the third (Q3) is the 75th percentile. The interquartile range (IQR), Q3 − Q1, is the spread of the middle half of the data, and like the median it ignores extremes.
The five-number summary gives the minimum, Q1, median, Q3 and maximum, and it describes a distribution's centre, spread and shape in five figures. For the practice order values it is roughly £5.51, £53.80, £99.21, £202.26 and £22,704. The gap between the median and Q3 is larger than between Q1 and the median, and the maximum is enormous next to Q3: both signs of a long right tail. A box plot draws exactly this summary.
Different tools calculate quartiles with slightly different interpolation methods, so small differences between tools on the same data are normal.
Skewed data and which summary to report
Skew describes asymmetry. In right-skewed (positively skewed) data, a long tail extends to the right: most values are modest and a few are very large. Incomes, order values, house prices and waiting times are typically right-skewed, and the mean lies above the median. In left-skewed (negatively skewed) data, the tail extends to the left and the mean lies below the median, as in the practice satisfaction scores, where most people answered high.
The practical rule follows from how each measure reacts:
- For symmetric data without outliers, report the mean and standard deviation.
- For skewed data or data with outliers, report the median and IQR, or percentiles, and consider giving the mean alongside with an explanation.
Reporting both, and noting when they differ substantially, is often the most honest choice, because the difference itself tells the reader the data is skewed.
Calculating each by hand once, then by tool
Every tool calculates these measures in one function call, and it is still worth working through each by hand once, on a small data set.
Take the values 2, 4, 4, 5, 10. The mean is 25 ÷ 5 = 5. The median is the middle value, 4. The mode is 4. The range is 10 − 2 = 8. The deviations from the mean are −3, −1, −1, 0 and 5; their squares are 9, 1, 1, 0 and 25, totalling 36. The population variance is 36 ÷ 5 = 7.2, and the sample variance is 36 ÷ 4 = 9, giving a sample standard deviation of 3.
Two things become obvious from doing this. The single value of 10 contributes 25 of the 36 squared deviations: the standard deviation is dominated by the most extreme value, just as the mean is. And removing the 10 changes the mean from 5 to 3.75 while barely moving the median, from 4 to 4. Knowing what each measure responds to is what lets you choose the right one when a tool gives you all of them at once.
Try it
An interactive exercise runs here: a real Linux machine in your browser that checks each step. The commands above work on any Linux machine too.
Practise what you just read
1. A set of orders has a mean value of 177.58 and a median of 99.21. Which figure better describes a typical order, and why?
Select one
Show answer
C. The mean uses every value, so a few very large orders pull it far above what most orders are worth. The median depends only on order and sits among the typical values, so it describes the typical order honestly in skewed data.
2. For the values 3, 7, 7, 9 and 14, what are the mean and the median?
Select one
Show answer
D. The sum is 40, and 40 divided by 5 is 8. Sorted, the middle of the five values is 7. The mean sits above the median because the 14 pulls it up, a small example of right skew.
3. For the sample 3, 7, 7, 9 and 14, what is the sample standard deviation?
Select one
Show answer
B. Deviations from the mean of 8 are -5, -1, -1, 1 and 6; their squares total 64. The sample variance divides by n - 1, giving 16, and its square root is 4. Dividing by n gives the population variance of 12.8 instead.
7 more questions on this objective are part of the full course.
Hands-on labs
Part of the free CompTIA Data+ DA0-002 course — 51 lessons and 74 hands-on labs.
This is an independent study companion for CompTIA Data+ DA0-002 and is not produced by or endorsed by CompTIA.