Statistics · AP Statistics
Exploring one-variable data
shape, centre and spread
Statistics is the science of learning from data, and data vary.
40 students in one class answered two questions: how do you get to school, and how many minutes does it take? In the figure each ball is one student, dropping onto the number line at their commute time.
No two mornings are alike. The times run from 8 to 56 minutes, about three quarters of them 26 or less. That pattern, which values occur and how often, is the distribution of the variable.
Beneath the dots, a histogram counts the same times in 5-minute bins, and below it a cumulative graph adds them up.
This chapter names the kinds of variables, draws them in tables and graphs, describes a distribution by its shape, centre and spread, measures each with a number, and ends with the most useful model of all: the normal distribution.
what can we learn from data?
Data are information about individuals; a variable is a characteristic that changes from one individual to the next.
Here the individuals are the 40 students. The red ball is student 5: travels by bus, 29 minutes. One student is one row of the data set; each variable is a column.
| student | mode | time (min) |
|---|
| 1 | walk | 8 |
| 2 | bike | 13 |
| 3 | bike | 14 |
| 4 | car | 12 |
| 5 | bus | 29 |
A statistical question expects variability in its answer. “How long does student 5 take to get to school?” has one answer. “How long do students in this class take to get to school?” has 40, and asks about their distribution.
Variation is everywhere, so a pattern in data may be real or may be chance. Statistics separates the two. The questions it asks are always the same: who was measured, what was measured, how, and what can be concluded about whom.
These 40 answers describe this class. Conclusions about all students at the school would need a random sample of them (Chapter 3).
categorical and quantitative variables
A categorical variable puts each individual into a group. A quantitative variable gives each individual a number that can be counted or measured.
How a student travels (walk, bike, bus, car) is categorical. Commute time in minutes is quantitative: arithmetic on it makes sense, and its values sit on a number scale.
In the figure the same 40 balls move between the two views. On the number line each sits at its time; sorted by mode they fall into four groups. The individuals do not change, only the variable we look at.
Quantitative variables are discrete (counts that can be listed: the number of siblings) or continuous (measurements on an interval: a time, a height).
Careful. Numbers are not always quantitative. A zip code or a jersey number labels a group; its average means nothing, so it is categorical. A quantitative variable can be made categorical by grouping: “more than 20 minutes, yes or no.”
frequency and relative frequency
A frequency table lists each category with its count. A relative frequency table gives each count as a proportion of the total.
| mode | frequency | relative frequency | percent |
|---|
| walk | 7 | 0.175 | 17.5% |
| bike | 8 | 0.200 | 20.0% |
| bus | 14 | 0.350 | 35.0% |
| car | 11 | 0.275 | 27.5% |
| total | 40 | 1.000 | 100.0% |
The relative frequencies add to 1 (or 100%), apart from rounding. They let groups of different sizes be compared: a class of 25 and a school of 2000 can each be 35% bus riders.
In context. 14 of the 40 students, a proportion of 14/40 = 0.350, ride the bus: the most common way this class gets to school.
The most common category is the mode of a categorical variable. A table of two categorical variables together, a two-way table, comes in Chapter 2.
bar charts and pie charts
A bar chart draws each category as a bar whose height is its frequency or relative frequency. A pie chart gives each a wedge of a circle in proportion.
Bars in a bar chart stand apart, since the categories have no scale between them, and their order is a choice. Ordering them by height makes the largest easy to see.
A pie wedge’s angle is its relative frequency × 360°: the bus wedge is 0.350 × 360° = 126°. A pie chart only works when the categories make one whole and every individual is in exactly one.
Describing a categorical distribution. Name the most and least frequent categories, and compare with proportions, in context: “35% of students ride the bus, more than any other mode; 17.5% walk.”
Misleading graphs. A bar chart whose vertical axis does not start at zero exaggerates differences. Pictures and 3D pies that change area and depth as well as height do too. Read the scale before the shape.
dotplots, stemplots, histograms and cumulative graphs
A graph of a quantitative variable shows its distribution on a number line: where the values are, and how they bunch and spread.
A dotplot puts one dot per individual above its value. A stemplot splits each value into a stem (here the tens) and a leaf (the ones):
| 0 | 8 8 8 9 9 9 |
|---|
| 1 | 0 0 0 1 1 2 2 3 3 4 4 4 5 7 7 7 8 |
|---|
| 2 | 2 2 2 3 4 5 6 6 8 8 9 9 |
|---|
| 3 | 0 5 5 8 |
|---|
| 4 | |
|---|
| 5 | 6 |
|---|
Key: 1 | 4 means 14 minutes. Both keep every value.
A histogram counts the values in equal intervals, or bins, here 5 minutes wide; the bars touch, because the scale is continuous. A time of exactly 15 goes in the bin 15 to 20. A different bin width can change the picture, so choose one that shows the shape without hiding detail.
A cumulative graph plots, at the end of each bin, the proportion of values below it. It reads percentiles: 70% of the class took less than 25 minutes, and the graph crosses 0.5 at the median, about 17 minutes.
shape, centre, spread and unusual features
Describe a distribution by its shape, centre, spread and any unusual features, always in the context of the data.
Shape. Symmetric: the two sides roughly mirror each other. Skewed right: a long tail toward larger values. Skewed left: a long tail toward smaller values. A skew is named for its tail, not its peak. Count the peaks too: unimodal, bimodal (two clusters, often two groups mixed), or uniform (no clear peak).
Unusual features. Gaps (stretches with no values), clusters, and outliers: values far from the rest.
The class, described. The distribution of commute times is unimodal and skewed right, peaking at 10 to 15 minutes. The median is about 17 minutes, and times range from 8 to 56 minutes. There is a gap from 38 to 56 minutes, and 56 minutes is a possible outlier.
The words “about” and “roughly” belong here: shape is judged by eye. 1.7 and 1.8 put numbers on centre and spread and give a rule for outliers.
mean, median, and which one resists
The mean is the sum of the values divided by how many there are. The median is the middle value once they are in order.
Nine of the class, in order: 8, 8, 8, 9, 12, 13, 14, 26, 29. The mean is 127/9 = 14.1 minutes. The median is the 5th of the 9 values, 12 minutes. With an even count, the median is the mean of the middle two.
The mean is the balance point. Put the values on a beam: it balances at x̄ (red), where the distances on either side cancel. The median (blue) only counts: half the values on each side.
Resistance. In the figure, the 29-minute commute slides out to 59. The mean follows it, to 17.4 minutes; the median stays at 12. The median is resistant to extreme values; the mean is not.
So in a distribution skewed right the mean is pulled toward the tail, above the median: for the whole class x̄ = 19.4 and the median is 17. Skewed left, the mean is below the median. For a skewed distribution or one with outliers, report the median.
range, IQR and standard deviation
The standard deviation measures the typical distance of the values from their mean.
| x | x − x̄ | (x − x̄)² |
|---|
| 8 | −6.11 | 37.35 |
| 13 | −1.11 | 1.23 |
| 14 | −0.11 | 0.01 |
| 12 | −2.11 | 4.46 |
| 29 | 14.89 | 221.68 |
| 26 | 11.89 | 141.35 |
| 9 | −5.11 | 26.12 |
| 8 | −6.11 | 37.35 |
| 8 | −6.11 | 37.35 |
The deviations (red) add to zero; their squares add to 506.89. Divide by n − 1 = 8 for the variance, s² = 63.36, and take the square root: s = 7.96 minutes.
Interpret it in context: these nine commute times typically vary by about 8.0 minutes from their mean of 14.1 minutes. s is 0 only when every value is the same, and like the mean it is not resistant.
The range is max − min. The quartiles Q1 and Q3 are the medians of the lower and upper halves (the median itself left out when n is odd); the interquartile range, IQR = Q3 − Q1, is the spread of the middle half, and resistant. The pth percentile is the value with p% of the data below it.
For the whole class: range 48, IQR 26 − 11 = 15, s = 10.4 minutes.
adding and multiplying every value
Adding a constant to every value shifts the centre and leaves the spread. Multiplying every value by a constant multiplies both.
Ten daily highs in °C, converted to °F by F = 1.8C + 32. The figure does it in two steps: every value × 1.8 (the dots spread apart), then + 32 (they move along together).
| mean | median | SD | IQR |
|---|
| °C | 21.3 | 22 | 2.95 | 6 |
| °F | 70.34 | 71.6 | 5.30 | 10.8 |
For y = a + bx (b > 0): measures of centre and position (mean, median, quartiles, percentiles) become a + b × the old value. Measures of spread (range, IQR, SD) are multiplied by b and ignore a. The variance is multiplied by b². The shape does not change.
The common mistake: adding 32 to the standard deviation. Shifting every value moves them all together; the distances between them, and from their mean, stay the same.
the boxplot and the 1.5 × IQR rule
A boxplot draws the five-number summary: a box from Q1 to Q3, a line at the median, and whiskers out to the smallest and largest values that are not outliers.
| min | Q1 | median | Q3 | max |
|---|
| 8 | 11 | 17 | 26 | 56 |
The 1.5 × IQR rule. A value is an outlier if it lies more than 1.5 × IQR below Q1 or above Q3:
No time is below −11.5; 56 is above 48.5, so it is an outlier, drawn on its own. The right whisker stops at 38, the largest time that is not. Another rule some use: more than 2 standard deviations from the mean, here above 40.2.
A boxplot shows skew: here the right whisker is longer and the median sits nearer Q1, so the times are skewed right. It hides the rest: the gap, the number of peaks, and n. Each quarter of the data, not each quarter of the length, holds about a quarter of the values.
shape, centre, spread and outliers, side by side
To compare distributions, draw them on one scale and compare shape, centre, spread and unusual features, in context and in comparative words.
| n | min | Q1 | median | Q3 | max | IQR |
|---|
| bus | 14 | 17 | 22 | 26 | 30 | 38 | 8 |
| car | 11 | 8 | 10 | 12 | 28 | 56 | 18 |
Shape. Bus commutes are roughly symmetric. Car commutes are skewed right, with an outlier at 56 minutes (above Q3 + 1.5 × IQR = 55).
Centre. The median bus commute, 26 minutes, is 14 minutes longer than the median car commute, 12 minutes.
Spread. Car commutes vary more: an IQR of 18 minutes against 8, and a range of 48 against 21.
Compare medians and IQRs when a distribution is skewed or has outliers. Lists of numbers are not a comparison: say which is greater. Graphs for comparing: side-by-side dotplots, parallel boxplots, back-to-back stemplots, and histograms stacked on the same scale.
the empirical rule and z-scores
A normal distribution is symmetric, single-peaked and bell-shaped. It is fixed by its mean μ and standard deviation σ, written N(μ, σ).
The heights of adult women are close to N(163, 7) in cm. The histogram is 200 of them, drawn so its area is 1, with the normal curve over it. μ and σ describe a model or population; x̄ and s describe data (here 163.7 and 6.9 cm).
The empirical rule. In any normal distribution about 68% of values lie within 1σ of μ, 95% within 2σ and 99.7% within 3σ.
| within | 1 SD | 2 SD | 3 SD |
|---|
| normal model | 68% | 95% | 99.7% |
| the 200 heights | 73.0% | 94.5% | 99.5% |
z-scores. A standardized score says how many standard deviations a value is from the mean, and in which direction:
A woman 175 cm tall is 1.71 standard deviations above the mean height. z-scores compare values on different scales; standardizing gives a distribution with mean 0 and SD 1, the standard normal.
areas, percentiles and the value at a percentile
In a normal model, the proportion of values in an interval is the area under the curve over it.
Below a value. What proportion of women are shorter than 170 cm?
About 84.1% of women are shorter than 170 cm: 170 cm is at about the 84th percentile. Above it is 1 − 0.841 = 0.159.
Between two values. P(155 < X < 170) = P(-1.14 < Z < 1.00) = 0.715.
A value from a percentile. The 90th percentile has area 0.90 to its left, at z = 1.282:
Show the work as the exam asks: name the distribution and its parameters, mark the boundary and the area wanted (a sketch), give the z-score or the calculator command with its inputs labelled (normalcdf: lower 155, upper 170, μ = 163, σ = 7), and answer in context.
checking data for normality
Before using a normal model for data, check that the data look normal. Many real distributions are not.
Graph the data. A normal model needs a dotplot or histogram that is roughly symmetric and single-peaked, with no outliers.
Check the empirical rule. Count the values within 1, 2 and 3 standard deviations of the mean. The heights give 73.0%, 94.5%, 99.5%, close to 68, 95, 99.7.
Look at a normal probability plot. Each value is plotted against the z-score it would have if the data were exactly normal. Normal data fall close to a straight line, as the heights do. Skewed data bend: the commute times curve upward at the right, the long right tail.
The empirical rule alone can mislead. 72.5% of commute times lie within one SD of the mean, close to 68%. But x̄ − 2s = 19.4 − 2(10.4) = −1.4 minutes, an impossible time: a normal model would put about 2.3% of commutes below it. When the mean is less than two SDs above a floor of 0, suspect skew to the right.
Exploring two-variable data →