Displaying and describing quantitative data
Frequency tables with bins, histograms and density histograms, shape (modes, symmetry, skewness, outliers), centre (mean and median), spread (range, IQR, mean absolute deviation, standard deviation), z-scores, the five-number summary, box plots and the 1.5 IQR outlier rule.
Textbook: Ch. 3 (without "Transforming skewed data") · Sessions: Module 3, lectures 3 to 5, tutorials 3 and 4 · About 70 minutes
Bins, histograms and density histogramsImportant
For a quantitative variable, first sort the values, then cut the number line into bins and count the cases in each bin. Decide what happens at a boundary: the course uses bins that are closed on the left and open on the right, written [a, b[. A histogram draws a bar per bin with a height equal to the count or the relative frequency. The bars touch, unless a bin is empty.
In a density histogram the area of a bar, not its height, equals the relative frequency of the bin. So the height is the density:
A bar in a density histogram
Commute times of 22 students: 9 fall in the bin [20, 30[ minutes and 3 in the wider bin [40, 60[.
Relative frequencies
Densities
Check
With unequal bins a plain count histogram would make the wide bin look important; the density histogram respects the area principle. The units of density are "% per minute".
Shape: modes, symmetry, skewness and outliersImportant
Describe a distribution by its shape, centre and spread, and mention anything unusual. For the shape, look at:
- Modes: humps. Unimodal (one), bimodal (two, often a sign of two groups mixed together), multimodal, or uniform (no clear hump, all bars about equal).
- Symmetry: the two halves around the centre mirror each other. Otherwise the distribution is skewed to the side of the longer tail: skewed right (long tail of high values, typical for incomes and prices) or skewed left.
- Outliers and gaps: values that stand apart from the rest. Always investigate them; never delete them silently.
Centre: mean and medianImportant
The median is the middle value of the sorted data (the average of the two middle values when n is even): about half of the values lie below it, and in a histogram it splits the area in two equal halves. The mean is the balance point of the histogram.
The median is resistant: outliers and a long tail hardly move it. The mean is pulled toward the tail. Hence: skewed right means mean > median, skewed left means mean < median, and for a symmetric distribution they are about equal. Report the median and the IQR for skewed data, the mean and the standard deviation for roughly symmetric data.
Spread: range, IQR, MAD and standard deviationImportant
The range = max − min depends only on the two extremes, so it is not resistant. The quartiles split the sorted data in four: Q1 is the median of the lower half and Q3 the median of the upper half (with n odd, the median itself is left out of both halves, as on the TI-84). The interquartile range IQR = Q3 − Q1 covers the middle 50% and is resistant.
Deviations from the mean, x − x̄, always add up to zero, so their plain average is useless. Two ways remove the minus signs: the mean absolute deviation (average of |x − x̄|) and the standard deviation, the quadratic mean (root-mean-square) of the deviations with n − 1 in the denominator:
Four prices by hand
Prices of 4, 6, 9 and 13 euro.
Mean
Deviations
Mean absolute deviation
Squared deviations
Standard deviation
The prices typically lie about 3.92 euro from their mean of 8 euro. Read a formula from the inside out: deviations, squares, mean, square root.
Whatever the shape, most values lie within three standard deviations of the mean: by Chebyshev's inequality at most 1/k2 of the values lie more than k SDs away, so at most 1/9 lie beyond 3 SDs.
z-scoresImportant
A z-score says how many standard deviations a value lies above (z > 0) or below (z < 0) the mean. It has no unit, so it lets you compare values measured on different scales. Standardising shifts the mean to 0 and the standard deviation to 1 without changing the shape.
Five-number summary, box plots and outliersImportant
The five-number summary is min, Q1, median, Q3, max (R: summary(x); TI-84: 1-Var Stats). A box plot draws a box from Q1 to Q3 with a line at the median, and whiskers that run to the most extreme values that are not outliers. A value is flagged as an outlier when it lies below Q1 − 1.5 IQR or above Q3 + 1.5 IQR. Side-by-side box plots compare the centre and spread of groups at a glance.
Weekly hours of nine student jobs
Hours: 12, 15, 15, 18, 20, 22, 25, 30, 58.
Centre
Quartiles
Fences
Outlier
Spread and z
The mean lies above the median: the distribution is skewed right by the 58-hour job. The median of 20 h and IQR of 12.5 h describe a typical job better. The descriptive statistics lab redoes this for any data.
Key takeaways
- Describe shape, centre and spread, and mention outliers.
- Density histogram: area = relative frequency, height = relative frequency / width.
- Skewed right: mean > median; use median and IQR for skewed data.
- s = √(Σ(x − x̄)2/(n − 1)), in the units of the data.
- z = (x − x̄)/s counts standard deviations from the mean.
- Outliers: below Q1 − 1.5 IQR or above Q3 + 1.5 IQR.
Multiple choice (10)
Ten wire diameters (cm): 0.481, 0.522, 0.515, 0.499, 0.553, 0.547, 0.507, 0.550, 0.539, 0.518. The mean is...
A five-number summary is 21, 38, 45, 49, 67 and the mean is 38.5. The shape is most likely...
The largest salary in a data set rises from 120,000 to 160,000. What changes?
A value has z = −1.5. This means...
Q1 = 40 and Q3 = 60. Which value is an outlier?
In a density histogram a bin [10, 15[ has density 4% per unit. Its relative frequency is...
The variance of a set of prices in euro is measured in...
For a strongly right-skewed income distribution the best summaries are...
Deviations from the mean of any data set add up to...
Removing a far outlier from a data set will most likely...
Exam-style open questions (3)
Summarise a small data set
Monthly phone bills (euro): 18, 22, 25, 25, 27, 30, 34, 75. Give the five-number summary, check for outliers and choose suitable summaries.
Show the worked outline
- Sorted, n = 8. Median = (25 + 27)/2 = 26 euro.
- Lower half 18, 22, 25, 25: Q1 = 23.5; upper half 27, 30, 34, 75: Q3 = 32; IQR = 8.5 euro.
- Upper fence 32 + 12.75 = 44.75: 75 euro is an outlier. Mean = 256/8 = 32 euro, pulled up by it.
- Report the median (26 euro) and IQR (8.5 euro), and mention the outlier.
Compare with z-scores
A student scores 72 on a statistics test (mean 60, SD 8) and 81 on a law test (mean 75, SD 5). On which test did the student do relatively better?
Show the worked outline
- Statistics: z = (72 − 60)/8 = 1.5.
- Law: z = (81 − 75)/5 = 1.2.
- Relative to the class the statistics score is better, although the law score is higher in points.
Standard deviation by hand
Compute the mean and standard deviation of 10, 12, 14, 20 kg, with all intermediate steps.
Show the worked outline
- Mean = 56/4 = 14 kg; deviations −4, −2, 0, 6 kg.
- Squares 16 + 4 + 0 + 36 = 56 kg2; variance 56/3 ≈ 18.67 kg2.
- s ≈ 4.32 kg.
LabDescriptive statistics lab
The default data are the student job example; the second data set redoes the four prices by hand.
LabDensity histogram lab
Switch to unequal bins to see why densities matter.