Module 1: Getting Started with Statistics
What statistics is really for, the language of the whole course, and how to read this friendly numbers-and-pictures approach. A gentle on-ramp before any formula.
Welcome to Statistics: Reading the World with Data
- Explain what statistics is and why every value comes with some uncertainty.
- Tell a population from a sample and a parameter from a statistic.
- Classify a variable as categorical or quantitative and name its role in a study.
The big picture
Welcome. If the word "statistics" makes you a little nervous, you are in good company, and this course is built for exactly that feeling. We are going to move slowly, draw pictures before we write formulas, and read every formula aloud in plain English the first time it appears. Here is the whole idea in one breath: statistics is the science of learning from data when the data does not tell the whole story by itself. A single number, like the average score on a test, is a summary of many messy, varied numbers underneath it. Statistics is the careful craft of turning that mess into a claim you can defend, while being honest about how sure you can be.
Think of a doctor who cannot possibly examine every person in a country but still wants to know whether a new medicine helps. Or a coach who wants to know if a training plan really makes players faster, or if last month's good games were just luck. In every case someone measures a small slice of the world and tries to say something trustworthy about the whole. That leap, from the slice you saw to the world you did not, is the beating heart of this subject.
Key idea: statistics turns limited, noisy data into careful, honest conclusions about a larger world.
Two jobs: describing and inferring
Statistics has two big jobs, and the course is organized around them. The first is describing data you already have: making a good graph, finding a typical value, measuring how spread out things are. This is honest bookkeeping, and it never reaches beyond the data in your hand. The second job is inferring: using a small sample to make a claim about a much larger group, always attached to a measure of how uncertain the claim is. Describing comes first because you cannot reason about data you have not yet looked at. Inferring comes later, once you trust your picture of the data.
A quick way to feel the difference: "the 30 students I surveyed slept 6.8 hours on average last night" is description. "The typical student at this whole school probably sleeps somewhere between 6.4 and 7.2 hours" is inference. The second sentence is braver, more useful, and requires the tools we will spend the second half of this course building.
Key idea: descriptive statistics summarizes the data you have; inferential statistics reaches beyond it, with stated uncertainty.
The four words the whole course uses
Four words come up on nearly every page, so let us meet them gently. A population is the entire group you want to learn about, such as every student at your school. A sample is the smaller group you actually measure, because reaching everyone is usually impossible. A parameter is a number that describes the whole population, and it is almost always unknown to you, like a treasure you cannot dig up. A statistic is a number you compute from your sample, which you use to estimate the parameter. A tiny memory hook keeps them straight: population goes with parameter, and sample goes with statistic.
Almost every hard problem later in the course is secretly the same shape. You can see a statistic. You cannot see the parameter. You want to say something trustworthy about the parameter anyway. Hold on to that picture, because it will make confidence intervals and hypothesis tests feel familiar instead of foreign when we get there.
Key idea: we compute a statistic from a sample to estimate a parameter we cannot directly see.
Kinds of variables
A variable is any feature that can change from one individual to the next; the individuals are the people or things you measure. Variables come in two flavors. A categorical variable sorts each individual into a group, such as eye color, favorite sport, or whether a coin landed heads. A quantitative variable is a number you can meaningfully do arithmetic with, such as height, age, or a test score. A simple test for "is this quantitative?" is to ask whether taking an average makes sense. The average of two heights is a real height; the "average" of two ZIP codes is nonsense even though both look like numbers. That single question will save you from a classic mistake later.
Quantitative variables split once more. Discrete variables are counts with gaps between the possible values, like the number of pets you own (you cannot own 2.5 dogs). Continuous variables can take any value in a range, limited only by how precisely you measure, like weight or time. You do not need to memorize a taxonomy so much as build the habit of asking, for every column of data, what kind of variable is this, because that one answer quietly decides which graph, which summary, and eventually which test is allowed.
Key idea: a variable is categorical (a group label) or quantitative (a number you can average); ask "does averaging make sense?" to tell them apart.
How to use this course
Every lesson follows the same gentle rhythm, and knowing the rhythm lets you relax into it. We open with the big picture in plain words. We build each idea with a small example and a picture before any symbols. When a formula finally appears, we read it aloud in English, then work an example one line at a time, writing the reason next to each step and checking the arithmetic so nothing feels like a magic trick. We pause at the exact spots where students get stuck, in little "where people get stuck" notes. We end with common misconceptions, a short recap, verified sources, key terms, a hands-on activity, and a ten-question check. Nothing here rewards memorizing without understanding, and everything rewards slowing down. Let us begin.
Where people get stuck: many students think statistics is a branch of math about getting one exact right answer. It is closer to careful reasoning under uncertainty. The arithmetic must be correct, yes, but the real skill is knowing what a number means and how much to trust it. If you can explain a result to a friend in plain words, you understand it.
Try it
A researcher measures the resting heart rate of 40 volunteers out of the 500 members of a gym. (a) What is the population? (b) What is the sample? (c) Is heart rate categorical or quantitative? (d) The average of the 40 rates is a parameter or a statistic?
Worked answer: (a) the population is all 500 gym members; (b) the sample is the 40 volunteers measured; (c) heart rate is quantitative and continuous, because averaging heart rates is meaningful; (d) it is a statistic, since it was computed from the sample. The true average for all 500 members would be the parameter, and we do not know it.
Common misconceptions
Myth: a big enough sample is basically the same as the population. Reality: no matter how large, a sample is still a subset, and any number from it is a statistic (an estimate), not a parameter. Only measuring every individual, a census, gives a parameter directly.
Myth: if the values look like numbers, the variable must be quantitative. Reality: numerals are sometimes just labels. ZIP codes, phone numbers, and jersey numbers are categorical, because doing arithmetic on them is meaningless.
Myth: statistics gives certain answers. Reality: the honest output of inference is always a range or a probability, never a guarantee. Owning that uncertainty is a strength, not a weakness.
Recap
Statistics is the science of learning from data despite its noise and limits. It describes the data you have and infers about the data you do not. A population is the whole group; a sample is the part you measure; a parameter describes the population and is usually unknown; a statistic comes from the sample and estimates the parameter. Variables are categorical or quantitative, and asking whether averaging makes sense tells them apart. This course teaches all of it gently, pictures first, one honest step at a time.
Sources
- OpenStax. (2023). Definitions of statistics, probability, and key terms. In Introductory statistics 2e. openstax.org
- College Board. (2020). AP Statistics course and exam description. apcentral.collegeboard.org
- Khan Academy. (n.d.). AP College Statistics. khanacademy.org
- Key terms
- Statistics
- The science of collecting, organizing, summarizing, and drawing conclusions from data.
- Population
- The entire group of individuals you want to learn about.
- Sample
- The subset of the population you actually measure.
- Parameter
- A number describing a whole population, usually unknown.
- Statistic
- A number computed from a sample, used to estimate a parameter.
- Categorical variable
- A variable that sorts individuals into groups rather than measuring a quantity.
- Quantitative variable
- A numeric variable you can do meaningful arithmetic with.
Module 2: Exploring One-Variable Data
How to picture and summarize a single variable: the right display for its type, its shape, its center and spread, and the normal model with z-scores that puts any value on a common ruler.
Displaying One-Variable Data and Describing Shape
- Choose the right display for a categorical or a quantitative variable.
- Read a dotplot, stemplot, and histogram and build a relative-frequency table.
- Describe a distribution by shape, center, spread, and unusual features.
The big picture
Numbers in a list hide their secrets. Look at forty exam scores in a column and your eye glazes over. Draw the same forty scores as a picture and, in one glance, you see where most students landed, how far apart they were, and whether anyone was unusually high or low. That is the whole reason for this lesson: a good graph turns a wall of numbers into a shape you can read. Before any average or formula, we learn to see the data.
The picture you draw depends on the kind of variable, so the first question is always the one from the last lesson: is this variable categorical or quantitative? Categorical data (favorite color, blood type) gets a bar chart. Quantitative data (heights, scores, times) gets a dotplot, a stemplot, or a histogram. Match the display to the type and the graph tells the truth; mismatch them and the graph quietly lies.
Key idea: the type of variable decides the display; categorical to bar chart, quantitative to dotplot, stemplot, or histogram.
Frequency and relative frequency
Underneath every one of these graphs is a simple table. You group the data and count how many values fall in each group. The count is the frequency. Divide a frequency by the total number of values and you get the relative frequency, a proportion between 0 and 1 that you can also read as a percent. Read that formula aloud: relative frequency is "the count in this group, out of everybody." Here are forty values grouped into five bins:
| Bin | Frequency | Relative frequency |
| 0 to 9 | 5 | 0.125 |
| 10 to 19 | 8 | 0.200 |
| 20 to 29 | 12 | 0.300 |
| 30 to 39 | 10 | 0.250 |
| 40 to 49 | 5 | 0.125 |
The relative frequencies add to 0.125 plus 0.200 plus 0.300 plus 0.250 plus 0.125, which is 1.000 exactly. That sum is a free error check: if your relative frequencies do not add to 1, you miscounted somewhere. Relative frequencies also let you compare groups of different sizes fairly, because 12 out of 40 (30 percent) and 300 out of 1000 (also 30 percent) are the same share even though the raw counts look nothing alike.
Key idea: relative frequency is a count divided by the total, and all the relative frequencies always sum to 1.
Dotplots and stemplots keep the actual values
A dotplot puts one dot above a number line for each value, stacking dots when values repeat. It is the friendliest display for a small dataset because it keeps every single data point visible. A stemplot (stem-and-leaf plot) is a clever cousin: it splits each number into a "stem" (the leading digits) and a "leaf" (the last digit). For the values 21, 23, 23, 27, 34, 38, 41 the stems are the tens digit and the leaves are the ones digit:
| Stem | Leaves |
| 2 | 1 3 3 7 |
| 3 | 4 8 |
| 4 | 1 |
The beauty of a stemplot is that it looks like a histogram turned on its side, yet you can still read the exact original numbers straight off it. That is something a histogram throws away.
Key idea: dotplots and stemplots show a distribution's shape while preserving the individual data values.
Histograms for larger datasets
When there are too many values for dots, the histogram takes over. You group the quantitative data into equal-width bins and draw one bar per bin whose height is the frequency (or relative frequency). Because the variable is quantitative, the bars touch: the horizontal axis is a continuous number line with no gaps. The histogram below shows the forty values from the table, and you can see a single mound peaking in the 20 to 29 bin.
Bin width is a real choice. Very wide bins smear the data into a featureless block; very narrow bins turn the graph into a jagged comb of noise. Aim for roughly 5 to 20 bins and try a couple of widths before you trust the shape, because the same data can look smooth or spiky depending on the bins.
Key idea: a histogram groups quantitative data into touching bars, and the chosen bin width shapes the picture.
Describing a distribution: shape, center, spread, unusual
Whenever you describe a distribution, say four things in order: shape, center, spread, and any unusual features. Shape is the overall form. A symmetric distribution has left and right halves that mirror each other. A right-skewed distribution has a long tail stretching toward high values (incomes, house prices, wait times all do this). A left-skewed distribution has a long tail toward low values (scores on an easy test). A distribution can also be uniform (roughly flat) or bimodal (two clear peaks), and two peaks often mean two different groups got blended together, like the heights of a mixed group of children and adults.
Here is the memory trick students find most useful for skew: the skew is the direction the tail points, not where the hump is. A right-skewed graph has its tall hump on the left and its long thin tail on the right, and it is the tail that names it. This is the single most common place people get the direction backwards.
Where people get stuck: "the peak is on the left, so it must be left-skewed." No. Look at the tail, not the peak. A pile on the left with a long tail dribbling to the right is right-skewed. Say "skewed toward the tail" to yourself every time and you will stop flipping it.
Finally, note any outliers, values sitting far from the rest. An outlier always earns a second look. It might be a typo, or it might be the most interesting point in the whole dataset, but you never silently delete it just for being far away.
Key idea: describe every distribution by shape, center, spread, and unusual features, and name skew by the direction of the tail.
Try it
A bin contains 18 of 60 total observations. (a) What is its relative frequency, as a decimal and a percent? (b) A histogram of monthly rents shows most values bunched low with a long tail reaching toward a few very expensive units. What shape is that, and which display would you use for the categorical variable "neighborhood"?
Worked answer: (a) relative frequency is 18 divided by 60, which equals 0.30, or 30 percent. (b) the long tail points toward high values, so the rent distribution is right-skewed; "neighborhood" is categorical, so you would use a bar chart, not a histogram.
Common misconceptions
Myth: a histogram and a bar chart are basically the same graph. Reality: a histogram shows a quantitative variable on a continuous axis, so its bars touch, while a bar chart shows a categorical variable with separated bars whose order can be rearranged freely. Using the wrong one misrepresents the data.
Myth: the peak of the graph tells you the direction of skew. Reality: the tail does. A tall hump on the left with a long right tail is right-skewed, because we name skew after the long thin tail, not the crowded hump.
Myth: the shape of a histogram is a fixed fact about the data. Reality: the bin width strongly affects the picture. Too-wide bins hide features and too-narrow bins invent noise, so a responsible analyst checks the shape under more than one bin width.
Recap
The display must match the variable type: bar charts for categorical data, and dotplots, stemplots, or histograms for quantitative data. Every display rests on a frequency table, and relative frequencies (counts over the total) always sum to 1 and let you compare unequal groups. Dotplots and stemplots keep the exact values; histograms group larger datasets into touching bars whose bin width you must choose thoughtfully. To describe any distribution, state its shape, center, spread, and unusual features, and remember that skew is named for the direction of the long tail, not the location of the peak.
Sources
- OpenStax. (2023). Histograms, frequency polygons, and time series graphs. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Frequency, frequency tables, and levels of measurement. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Displaying and comparing quantitative data. khanacademy.org
- Key terms
- Distribution
- The pattern of values a variable takes and how often each occurs.
- Frequency
- The count of data values in a bin or category.
- Relative frequency
- A frequency divided by the total, giving a proportion that sums to 1 over all groups.
- Histogram
- A graph of a quantitative variable using touching bars over equal-width bins.
- Stemplot
- A display that splits each value into a stem and a leaf, keeping the original numbers.
- Skew
- Asymmetry in a distribution, named for the direction of the long tail.
- Outlier
- A value lying far from the bulk of the data, always worth investigating.
Measures of Center and Spread
- Compute the mean and median and explain why the median resists outliers.
- Calculate a sample standard deviation step by step and read it as typical distance from the mean.
- Choose resistant summaries for skewed data and non-resistant ones for symmetric data.
The big picture
A picture shows you a whole distribution, but often you want just one or two numbers that stand in for it. Two questions cover almost everything: "what is a typical value?" (that is center) and "how spread out are the values?" (that is spread). This lesson builds both, gently, with every calculation shown one line at a time. By the end you will not only compute a standard deviation, you will feel what it means.
Here is the honest secret of this lesson: the arithmetic is easy, but choosing which summary to report is where the real judgment lives. The same dataset can look modest or alarming depending on whether you quote a mean or a median, so we will spend as much time on "which one" as on "how."
Key idea: center answers "what is typical?" and spread answers "how much do values vary?"; choosing the right measure matters as much as computing it.
The mean and the median
The mean is the everyday average: add all the values and divide by how many there are. Read the formula aloud: the mean is "the total of everything, shared equally among all of them." We write the sample mean as x-bar. Physically, the mean is the balance point of the data, the spot where the values would balance if they were weights on a ruler. Every value pulls on that balance point, which is the mean's strength (it uses all the information) and its weakness (one extreme value can drag it far).
The median is the middle value once the data is sorted. Half the values sit at or below it, half at or above. If there is an odd number of values, the median is the single one in the middle; if even, it is the average of the two middle ones. The median cares only about the order of the values, not their exact size, which makes it resistant: extreme values barely budge it.
Worked example. Find the mean and median of 4, 7, 7, 9, 10, 3.
- Sum the values: 4 plus 7 plus 7 plus 9 plus 10 plus 3 equals 40. (reason: the mean needs the total)
- Count them: there are 6 values, so n equals 6.
- Mean: 40 divided by 6 equals 6.67, rounded to two decimals. (reason: total shared among all)
- Sort for the median: 3, 4, 7, 7, 9, 10. (reason: the median is a position, so order first)
- Median: with 6 values, average the 3rd and 4th, which are 7 and 7, so (7 plus 7) divided by 2 equals 7.
Now watch resistance in action. Add one big value, 100, to the set, making 3, 4, 7, 7, 9, 10, 100. The new mean is 140 divided by 7 equals 20, but the new median is still the middle value, 7. One point dragged the mean by more than 13 units and moved the median not at all. That is exactly why the median is preferred for skewed data like incomes and home prices, while the mean shines for symmetric data with no wild outliers.
Key idea: the mean uses every value and is pulled by outliers; the median is the resistant middle and barely moves.
Shape predicts which is bigger
The relationship between mean and median is itself a clue to shape. In a right-skewed distribution, the long high tail drags the sensitive mean above the median. In a left-skewed distribution, the mean is pulled below the median. In a symmetric distribution they roughly agree. So when a news report says the mean household income is far above the median, you can infer, without seeing the data, that incomes are right-skewed, with a relatively few very high earners lifting the average. That is why economists usually quote the median: it better reflects the typical household.
Key idea: mean above median suggests right skew, mean below median suggests left skew, mean near median suggests symmetry.
Spread: range, IQR, and standard deviation
Two datasets can share a mean yet feel completely different because of spread. Imagine two teams that both average 40 hours a week: one where everyone works near 40, and one where half work 20 and half work 60. Same center, very different experience. Three measures capture spread. The range (maximum minus minimum) is simple but uses only the two extremes. The interquartile range, or IQR, is the spread of the middle half of the data and is resistant to outliers (we build it fully in the next lesson). The standard deviation is the one statistics is built on, and it reports the typical distance of values from the mean.
Read the standard deviation aloud as "roughly how far, on average, a value sits from the mean." A small standard deviation means the values huddle near the mean; a large one means they scatter widely. It is always zero or positive, and it equals zero only when every value is identical.
Key idea: the standard deviation is the typical distance of the data from its mean.
Computing a sample standard deviation, step by step
To find the sample standard deviation, follow four steps: (1) find the mean; (2) subtract the mean from each value to get deviations; (3) square each deviation; (4) add the squares, divide by n minus 1, then take the square root. Why square the deviations? Because the deviations always sum to exactly zero (positives and negatives cancel at the balance point), so their plain average is useless. Squaring makes every term positive and punishes big misses more than small ones. Why divide by n minus 1 instead of n? Because deviations taken from the sample mean run slightly too small, and dividing by the smaller number n minus 1 corrects that bias; this is called Bessel's correction.
Worked example. Find the sample standard deviation of 2, 4, 4, 4, 5, 5, 7, 9.
- Mean: the sum is 2 plus 4 plus 4 plus 4 plus 5 plus 5 plus 7 plus 9 equals 40, and n equals 8, so x-bar equals 40 divided by 8 equals 5.
| x | 2 | 4 | 4 | 4 | 5 | 5 | 7 | 9 |
| x minus 5 | -3 | -1 | -1 | -1 | 0 | 0 | 2 | 4 |
| (x minus 5) squared | 9 | 1 | 1 | 1 | 0 | 0 | 4 | 16 |
- Sum the squared deviations: 9 plus 1 plus 1 plus 1 plus 0 plus 0 plus 4 plus 16 equals 32. (reason: total squared distance)
- Divide by n minus 1: 32 divided by (8 minus 1) equals 32 divided by 7 equals 4.57. This is the sample variance, s squared. (reason: Bessel's correction)
- Take the square root: the square root of 4.57 is 2.14, rounded to two decimals. This is s, the sample standard deviation. (reason: return to the original units)
So the values sit about 2.14 units from the mean of 5, on average, which matches the eye: most values are within a couple of units of 5, with the 9 reaching a bit farther. (For reference, if these eight numbers were an entire population, you would divide by 8 instead of 7, giving variance 4.0 and a population standard deviation of exactly 2.0. The two answers are close and converge as n grows.)
Where people get stuck: forgetting the final square root and reporting the variance as if it were the standard deviation. The variance here is 4.57 in "squared units," which means nothing in plain language; the standard deviation is 2.14 in the original units. Always finish with the square root, and always attach the units.
Key idea: variance is the average squared deviation using n minus 1; the standard deviation is its square root, back in the original units.
Try it
For the data 5, 8, 8, 10, 14: (a) find the mean and median; (b) find the sample standard deviation.
Worked answer: (a) sum is 5 plus 8 plus 8 plus 10 plus 14 equals 45, divided by 5 equals mean 9; sorted the middle value is 8, so the median is 8. (b) deviations from 9 are -4, -1, -1, 1, 5; squares are 16, 1, 1, 1, 25; sum is 44; divide by n minus 1 equals 44 divided by 4 equals 11; the square root of 11 is about 3.32. So the standard deviation is roughly 3.32 units.
Common misconceptions
Myth: the mean is always the best measure of center. Reality: the mean is easily distorted by outliers and skew. For incomes, home prices, or any long-tailed data, the median gives a far more honest picture of the typical value.
Myth: you always divide by n minus 1 for a standard deviation. Reality: you divide by n minus 1 only for a sample, to correct bias when estimating a population. If your data is the entire population, you divide by n.
Myth: a standard deviation can be negative when data trends downward. Reality: spread has no direction. Built from squared deviations and a square root, the standard deviation is always zero or positive.
Recap
Center is a single typical value; the mean is the balance point that uses every value, and the median is the resistant middle. The mean sits above the median in right-skewed data and below it in left-skewed data, so their gap reveals shape. Spread measures variability: the range uses only the extremes, the IQR captures the resistant middle half, and the standard deviation reports the typical distance from the mean. To compute a sample standard deviation, find the mean, take deviations, square them, average using n minus 1, and take the square root, remembering that final root and the original units.
Sources
- OpenStax. (2023). Measures of the center of the data. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Measures of the spread of the data. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Summarizing quantitative data. khanacademy.org
- Key terms
- Mean
- The sum of all values divided by how many there are; the balance point of the data.
- Median
- The middle value of sorted data; resistant to outliers.
- Resistant measure
- A summary, like the median or IQR, barely affected by extreme values.
- Range
- The maximum value minus the minimum value.
- Standard deviation
- The typical distance of values from the mean, in the original units.
- Variance
- The average squared deviation from the mean; the standard deviation squared.
- Deviation
- The difference between a value and the mean, x minus x-bar.
Position: Percentiles, the Five-Number Summary, and Boxplots
- Find the five-number summary and the interquartile range of a dataset.
- Apply the 1.5 times IQR rule to flag potential outliers.
- Sketch and read a boxplot and use side-by-side boxplots to compare groups.
The big picture
So far we have summarized a distribution with a single center and a single spread. But sometimes you want to know about position: where does a particular value stand relative to the rest? Percentiles answer that, and five well-chosen positions, the five-number summary, give a quick skeleton of the whole distribution. From that skeleton we draw the boxplot, the display that is unbeatable for comparing several groups side by side and for spotting outliers at a glance.
Key idea: position summaries describe where values fall in the order of the data, and five of them sketch the whole distribution.
Percentiles
The pth percentile is the value with p percent of the data at or below it. If your test score is at the 90th percentile, then 90 percent of test-takers scored at or below you. Percentiles are the natural language for standardized tests, growth charts, and income brackets, precisely because they describe rank rather than raw amount. The median is just the 50th percentile, the value with half the data at or below it.
Key idea: the pth percentile is the value with p percent of the data at or below it, and the median is the 50th percentile.
The five-number summary
The five-number summary is the minimum, first quartile, median, third quartile, and maximum. The quartiles cut the sorted data into four equal quarters. The first quartile Q1 is the median of the lower half; the third quartile Q3 is the median of the upper half. So a quarter of the data lies below Q1, half lies below the median, and three quarters lies below Q3. Together the five numbers tell you where the data starts, where its middle 50 percent sits, and where it ends.
Worked example. Find the five-number summary of the 7 sorted values 3, 5, 7, 8, 12, 13, 15.
- Minimum is 3 and maximum is 15. (reason: first and last after sorting)
- Median (Q2): with 7 values the middle is position 4, which is 8. (reason: (7 plus 1) divided by 2 equals position 4)
- Lower half (values strictly below the median): 3, 5, 7, so Q1 is their median, 5.
- Upper half (values strictly above the median): 12, 13, 15, so Q3 is their median, 13.
The interquartile range is Q3 minus Q1, which is 13 minus 5 equals 8. The IQR measures the spread of the middle half of the data. Because it throws away the extreme quarter on each end, it is resistant to outliers, which is exactly why it pairs with the median for skewed data.
Key idea: the five-number summary is min, Q1, median, Q3, max, and Q3 minus Q1 is the resistant IQR.
The 1.5 times IQR rule for outliers
A value is flagged as a potential outlier if it falls below the lower fence Q1 minus 1.5 times IQR, or above the upper fence Q3 plus 1.5 times IQR. Read that aloud: "step one and a half IQRs past the edges of the box; anything beyond is worth a look." For our data the fences are:
- Lower fence: 5 minus 1.5 times 8 equals 5 minus 12 equals -7. (reason: Q1 minus 1.5 IQR)
- Upper fence: 13 plus 1.5 times 8 equals 13 plus 12 equals 25. (reason: Q3 plus 1.5 IQR)
Every value lies between -7 and 25, so this dataset has no outliers. The 1.5 multiplier is a convention, not a law: it is tuned so that for roughly bell-shaped data only a tiny fraction of genuine values get flagged, which is why a flag means "investigate," not "delete."
Drawing and reading a boxplot
To draw a boxplot, mark Q1, the median, and Q3 to form the box, then extend whiskers to the smallest and largest values that are not outliers. Plot any outliers as separate dots beyond the whiskers. A boxplot shows center (the median line), spread (the box width for the middle half, the whiskers for the rest), and skew: a longer whisker on one side, or a median shoved toward one end of the box, signals a tail that way. But note what a boxplot hides. Because it reports only five numbers, it cannot reveal whether a distribution is bimodal; two very different shapes can produce identical boxplots, so for a single variable a histogram is often more revealing.
Where people get stuck: assuming a longer section of the boxplot holds more data. It does not. Each of the four sections, the two whiskers and the two halves of the box, contains the same 25 percent of the observations. A longer section means those 25 percent are more spread out, not that there are more of them.
Key idea: a boxplot draws the five-number summary as a box with whiskers, and each of its four pieces holds a quarter of the data.
Comparing groups side by side
The real payoff comes when you line several boxplots up on one axis, one per group. Plot test scores for three class sections and, in a single glance, you can compare their medians (which section is typically higher), their spreads (which is more consistent, shown by a narrower box), and their outliers (which section has an unusually low or high student). This clean, clutter-free comparison is a task histograms do poorly and boxplots do beautifully, which is why boxplots are a staple of exploratory data analysis and a favorite on the AP exam.
Try it
For the sorted data 2, 4, 5, 7, 8, 10, 12, 14 (n equals 8), find the five-number summary, the IQR, and check for outliers.
Worked answer: the median is the average of the 4th and 5th values, (7 plus 8) divided by 2 equals 7.5; Q1 is the median of the lower four (4 and 5), (4 plus 5) divided by 2 equals 4.5; Q3 is the median of the upper four (10 and 12), (10 plus 12) divided by 2 equals 11. So IQR equals 11 minus 4.5 equals 6.5. The upper fence is 11 plus 1.5 times 6.5 equals 11 plus 9.75 equals 20.75 and the lower fence is 4.5 minus 9.75 equals -5.25, so no value is an outlier.
Common misconceptions
Myth: a longer box or whisker means more data points there. Reality: each section holds the same 25 percent of the observations; a longer section just means those points are more spread out.
Myth: any value flagged by the 1.5 times IQR rule is an error to remove. Reality: the rule only marks a value as worth investigating. Many flagged points are perfectly real, and deleting them without cause biases the analysis.
Myth: two datasets with the same boxplot have the same distribution. Reality: a boxplot shows only five numbers, so it cannot reveal a second peak. A bimodal set and a smooth mound can share an identical boxplot.
Recap
Percentiles describe rank: the pth percentile has p percent of the data at or below it, and the median is the 50th. The five-number summary (min, Q1, median, Q3, max) sketches a distribution, and Q3 minus Q1 is the resistant IQR. The 1.5 times IQR rule flags values beyond the fences Q1 minus 1.5 IQR and Q3 plus 1.5 IQR as worth investigating, not deleting. A boxplot draws this skeleton as a box with whiskers, with each of its four pieces holding a quarter of the data, and side-by-side boxplots make comparing groups effortless.
Sources
- OpenStax. (2023). Box plots. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Measures of the location of the data. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Summarizing quantitative data. khanacademy.org
- Key terms
- Percentile
- The value with a given percent of the data at or below it.
- Five-number summary
- The minimum, Q1, median, Q3, and maximum of a dataset.
- Quartile
- A value dividing sorted data into quarters: Q1, Q2 (median), and Q3.
- Interquartile range (IQR)
- Q3 minus Q1, the spread of the middle 50 percent of the data.
- Boxplot
- A display of the five-number summary as a box with whiskers.
- 1.5 times IQR rule
- A value beyond Q1 minus 1.5 IQR or Q3 plus 1.5 IQR is a potential outlier.
- Fence
- The cutoff Q1 minus 1.5 IQR or Q3 plus 1.5 IQR used to flag outliers.
The Normal Distribution and z-Scores
- Standardize a value into a z-score and read it as a number of standard deviations from the mean.
- Use the empirical (68-95-99.7) rule to estimate proportions under a normal curve.
- Compare values from different distributions by putting them on the common z-score scale.
The big picture
Many things in nature and testing pile up in a familiar bell shape: lots of values near the middle, fewer as you move out, and roughly symmetric tails. That shape is the normal distribution, and it is the single most useful model in statistics. This lesson gives you two tools built on it: the z-score, which puts any value on a universal ruler, and the empirical rule, which turns that ruler into quick percentages. With them you can compare a test score to a height to a reaction time, all on the same scale.
Key idea: the normal distribution is the bell-shaped model, and z-scores let us compare any values on one common scale.
The shape of the normal curve
A normal distribution is symmetric and bell-shaped, fully described by two numbers: its mean (the center, where the peak sits) and its standard deviation (how wide the bell is). Change the mean and the whole bell slides left or right; change the standard deviation and it gets narrower and taller or wider and flatter, but it always keeps the same graceful shape. Because it is symmetric, the mean and median of a normal distribution are equal, sitting exactly under the peak.
Key idea: a normal curve is set by its mean (center) and standard deviation (width), and it is perfectly symmetric.
The z-score: a universal ruler
A z-score tells you how many standard deviations a value sits above or below the mean. Read the formula aloud before you ever use it: "take how far the value is from the mean, then measure that gap in standard deviations." In symbols, z equals (x minus the mean) divided by the standard deviation. A positive z means above the mean, a negative z means below, and z equals 0 means exactly average. The magic is that z-scores strip away the original units, so a value from any distribution becomes directly comparable to a value from any other.
Worked example. A student scores 85 on a test with mean 70 and standard deviation 6. Find the z-score.
- Find the gap from the mean: 85 minus 70 equals 15. (reason: how far above average)
- Measure that gap in standard deviations: 15 divided by 6 equals 2.5. (reason: divide by the standard deviation)
- So z equals 2.5. (interpretation: the score is 2.5 standard deviations above the mean, quite high)
Now compare two students in different classes. Ana scored 85 in the class above (mean 70, standard deviation 6), so her z is 2.5. Ben scored 90 in a class with mean 80 and standard deviation 8. Ben's z is (90 minus 80) divided by 8 equals 10 divided by 8 equals 1.25. Even though Ben's raw score is higher, Ana's z-score of 2.5 beats Ben's 1.25, so Ana did better relative to her class. That is the whole point of standardizing: raw scores from different tests are apples and oranges, but z-scores are all apples.
Where people get stuck: forgetting the sign, or dividing by the wrong number. Always subtract the mean first (the value minus the mean, never the other way around), keep the negative sign if the value is below the mean, and divide by the standard deviation, not the variance. A negative z is not a mistake; it just means below average.
Key idea: z equals (value minus mean) divided by standard deviation, so a z-score is a value's distance from the mean measured in standard deviations.
The empirical rule: 68, 95, 99.7
For any normal distribution, the empirical rule (also called the 68-95-99.7 rule) says that about 68 percent of values fall within 1 standard deviation of the mean, about 95 percent fall within 2, and about 99.7 percent fall within 3. In z-score language, that is z between -1 and 1, between -2 and 2, and between -3 and 3. The picture below shows the bands.
Worked example. Adult resting heart rates are roughly normal with mean 70 beats per minute and standard deviation 10. About what percent of people have a rate between 60 and 80?
- 60 is one standard deviation below the mean: (60 minus 70) divided by 10 equals -1.
- 80 is one standard deviation above the mean: (80 minus 70) divided by 10 equals 1.
- The interval is z from -1 to 1, so by the empirical rule about 68 percent of people fall in it.
What about above 90? That is z equals (90 minus 70) divided by 10 equals 2, so we want the fraction above 2 standard deviations. Since 95 percent lie within 2 standard deviations, 5 percent lie outside, split evenly between the two tails by symmetry, so about 2.5 percent lie above 90.
Key idea: in a normal distribution, about 68, 95, and 99.7 percent of values lie within 1, 2, and 3 standard deviations of the mean.
Beyond the empirical rule
The empirical rule only handles whole numbers of standard deviations. For an in-between z, like z equals 1.4, you use a standard normal table or a calculator, which reports the exact proportion of the curve below any z-score. The idea is identical, though: every normal question becomes a z-score question, and then a lookup. We will lean on this heavily later, because the sampling distributions behind confidence intervals and tests are themselves approximately normal.
Try it
Heights of a group are normal with mean 168 cm and standard deviation 8 cm. (a) Find the z-score of a height of 184 cm. (b) About what percent of the group is taller than 184 cm?
Worked answer: (a) z equals (184 minus 168) divided by 8 equals 16 divided by 8 equals 2, so 184 cm is 2 standard deviations above the mean. (b) about 95 percent lie within 2 standard deviations, so about 5 percent lie in the two tails combined; by symmetry about 2.5 percent lie above z equals 2, so roughly 2.5 percent of the group is taller than 184 cm.
Common misconceptions
Myth: a negative z-score means something went wrong. Reality: a negative z simply means the value is below the mean. Half of all values in a symmetric distribution have negative z-scores.
Myth: the empirical rule works for any distribution. Reality: the 68-95-99.7 percentages hold only for normal (bell-shaped) distributions. For a skewed or bimodal distribution they can be badly wrong.
Myth: a higher raw score always means a better relative performance. Reality: only the z-score accounts for each distribution's mean and spread. A lower raw score can have a higher z-score, and so be more impressive, if its test was harder or tighter.
Recap
The normal distribution is the symmetric bell model, described entirely by its mean and standard deviation. A z-score, (value minus mean) divided by standard deviation, measures how many standard deviations a value sits from the mean and strips away units so any two values become comparable. The empirical rule says about 68, 95, and 99.7 percent of a normal distribution falls within 1, 2, and 3 standard deviations of the mean, which lets you estimate proportions quickly; for in-between z-scores you use a table or calculator. These tools reappear throughout inference.
Sources
- OpenStax. (2023). The standard normal distribution. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Introduction to the normal distribution. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Density curves and the normal distribution. khanacademy.org
- Key terms
- Normal distribution
- A symmetric, bell-shaped model described by its mean and standard deviation.
- z-score
- How many standard deviations a value lies from the mean: (value minus mean) over standard deviation.
- Standardize
- To convert a value into a z-score so it can be compared across distributions.
- Empirical rule
- About 68, 95, and 99.7 percent of a normal distribution lies within 1, 2, and 3 standard deviations of the mean.
- Standard normal distribution
- The normal distribution with mean 0 and standard deviation 1, used with z-scores.
- Percentile (normal)
- The proportion of a normal distribution at or below a given value, found from its z-score.
- Symmetric
- Having mirror-image left and right halves, as the normal curve does.
Module 3: Exploring Two-Variable Data
How two quantitative variables move together: scatterplots, the correlation coefficient, and the least-squares regression line, plus the famous warning that correlation is not causation.
Scatterplots and Correlation
- Build and describe a scatterplot by direction, form, strength, and unusual points.
- Interpret the correlation coefficient r and know its range and limits.
- Explain clearly why correlation does not imply causation.
The big picture
Everything so far described one variable at a time. Now we ask a richer question: how do two quantitative variables move together? Do students who study more tend to score higher? Do taller people tend to weigh more? The picture for this is the scatterplot, and the number that summarizes the straight-line part of the pattern is the correlation coefficient, written r. This lesson also delivers the most important warning in all of statistics, one you have surely heard but will now truly understand: correlation is not causation.
Key idea: two quantitative variables are explored with a scatterplot and summarized, for straight-line patterns, by the correlation r.
The scatterplot
A scatterplot plots one dot per individual, using one variable for the horizontal axis (the explanatory variable, the one you think might explain or predict) and the other for the vertical axis (the response variable, the outcome). To describe a scatterplot, mention four things, much as with a single distribution: direction (positive if the cloud rises to the right, negative if it falls), form (linear, curved, or none), strength (how tightly the points hug the pattern), and any unusual points (outliers off the pattern). The scatterplot below shows a positive, roughly linear, moderately strong relationship.
Where people get stuck: mixing up the axes. The explanatory variable (the presumed cause or predictor) goes on the horizontal x-axis, and the response (the outcome) goes on the vertical y-axis. If you are predicting weight from height, height is x and weight is y. Getting this backwards will not change the correlation, but it will confuse every interpretation and it matters for the regression line in the next lesson.
Key idea: describe a scatterplot by direction, form, strength, and unusual points, with the explanatory variable on the x-axis.
The correlation coefficient r
The correlation coefficient r measures the strength and direction of the linear relationship between two quantitative variables. Read what it does in plain words: r asks, on average, when one variable is above its mean, is the other also above its mean? It is computed by standardizing both variables into z-scores and averaging their products, so it inherits the unit-free nature of z-scores. You will usually get r from a calculator, but knowing it is an average of products of z-scores explains all of its properties.
Three facts pin down r. First, it always lies between -1 and 1. Second, the sign matches the direction: positive r for an upward cloud, negative for a downward one. Third, the magnitude measures strength: r near 1 or -1 means the points cluster tightly around a line, r near 0 means little or no linear relationship. An r of exactly 1 or -1 means the points lie perfectly on a straight line. As a rough guide, r around 0.3 is weak, around 0.6 moderate, and above 0.8 strong, though context always matters.
Worked reading. Suppose hours studied and exam score have r equals 0.74. Interpret it: there is a positive, moderately strong linear association, so students who study more tend to score higher, and the points cluster fairly closely around an upward line. Note the careful word "tend"; r describes a trend across many people, not a guarantee for any one person.
Key idea: r runs from -1 to 1, its sign gives direction, its magnitude gives the strength of the linear pattern, and it has no units.
What r does not do
Correlation has three famous blind spots, and every one is a favorite exam trap. First, r only measures straight-line association. A strong curved relationship (like a U-shape) can have r near 0 even though the variables are tightly related; a scatterplot would show the curve that r misses, which is why you always plot before you trust r. Second, r is not resistant. A single outlier can inflate or deflate it dramatically, so one unusual point can make a weak relationship look strong or vice versa. Third, and most important, r says nothing about causation.
Key idea: r captures only linear association, is easily distorted by outliers, and never establishes cause.
Correlation is not causation
This is the phrase to tattoo on your statistical soul. Two variables can be strongly correlated without either one causing the other. The classic reason is a lurking variable (a confounder), a third factor that drives both. Ice cream sales and drowning deaths are strongly positively correlated, but ice cream does not cause drowning; hot weather drives both, since heat sends people to buy ice cream and to swim. Neighborhoods with more firefighters at a blaze also have more fire damage, but firefighters do not cause damage; the size of the fire drives both. Whenever you see a correlation, ask "could a third variable be behind this?" before you ever whisper the word cause.
The only way to establish causation is a well-designed experiment with random assignment, which we build in Module 4. Observational data, no matter how strong its correlations, can suggest causal ideas but cannot prove them, because a lurking variable can always be hiding.
Key idea: a correlation may be explained by a lurking variable, so only a randomized experiment can establish causation.
Try it
A study finds that among towns, the number of churches and the number of bars are strongly positively correlated (r near 0.9). (a) Does building more churches cause more bars? (b) What lurking variable likely explains the correlation?
Worked answer: (a) no; this is a correlation, not causation, and it would be absurd to claim churches cause bars. (b) the lurking variable is town population: bigger towns have more of almost everything, including both churches and bars, which creates the correlation without any direct link between the two.
Common misconceptions
Myth: a strong correlation proves that one variable causes the other. Reality: correlation measures association only. A lurking variable, or pure coincidence, can create a strong correlation with no causal link, and only a randomized experiment can establish cause.
Myth: a correlation near zero means the two variables are unrelated. Reality: r only measures straight-line association. A strong curved relationship can have r near zero, so a scatterplot may reveal a pattern that r completely misses.
Myth: correlation is measured in the units of the variables. Reality: r is built from z-scores and has no units at all, which is exactly why it can compare relationships between totally different pairs of variables.
Recap
A scatterplot displays two quantitative variables, with the explanatory variable on the x-axis, and is described by direction, form, strength, and unusual points. The correlation coefficient r summarizes the strength and direction of the linear pattern, always lies between -1 and 1, is unit-free, and is an average of products of z-scores. But r measures only straight-line association, is not resistant to outliers, and, most importantly, never establishes causation, because a lurking variable can drive both variables. Only a randomized experiment can prove cause.
Sources
- OpenStax. (2023). Testing the significance of the correlation coefficient. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Introduction to linear regression and correlation. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Exploring bivariate numerical data. khanacademy.org
- Key terms
- Scatterplot
- A graph of paired values with one dot per individual, showing two quantitative variables.
- Explanatory variable
- The predictor variable, plotted on the horizontal x-axis.
- Response variable
- The outcome variable, plotted on the vertical y-axis.
- Correlation coefficient (r)
- A unit-free number from -1 to 1 measuring the strength and direction of a linear relationship.
- Lurking variable
- A hidden third variable that influences both variables and can create a misleading correlation.
- Direction
- Whether a scatterplot's pattern rises (positive) or falls (negative) from left to right.
- Strength
- How tightly the points in a scatterplot cluster around the overall pattern.
Least-Squares Regression
- Interpret the slope and intercept of a least-squares regression line in context.
- Use a regression equation to predict and understand why extrapolation is risky.
- Interpret r-squared and residuals as measures of how well the line fits.
The big picture
A scatterplot with a linear pattern begs for a line drawn through it, a line we can use to predict. If studying more tends to raise scores, what score does the trend predict for 5 hours of study? The least-squares regression line is the best straight line for this job, and once we have it, the slope and intercept tell a story in the variables' own units. This lesson turns the correlation of the last lesson into a working prediction tool, while being honest about where prediction breaks down.
Key idea: regression fits a line to a linear scatterplot so we can predict the response from the explanatory variable.
The regression equation
We write the fitted line as y-hat equals a plus b times x, where y-hat (read "y-hat") is the predicted response, a is the intercept, and b is the slope. The hat matters: y-hat is the line's prediction, not an actual observed value. Read the equation aloud: "the predicted outcome equals a starting amount, plus the slope times the input." The slope b is the heart of it.
Interpreting the slope. The slope is the predicted change in y for each one-unit increase in x. Say a line predicting exam score from hours studied is y-hat equals 52 plus 6 times x. The slope 6 means: for each additional hour studied, the predicted exam score rises by 6 points. Always state a slope in context and in units, "6 points per hour," never just "6."
Interpreting the intercept. The intercept a is the predicted y when x equals 0. Here a equals 52 predicts a score of 52 for a student who studies 0 hours. Sometimes the intercept is meaningful, sometimes it is a mathematical placeholder if x equals 0 is far outside the data or impossible (a predicted weight at height 0, say). Interpret it, but flag when it is not realistic.
Worked prediction. Using y-hat equals 52 plus 6x, predict the score for a student who studies 5 hours.
- Substitute x equals 5: y-hat equals 52 plus 6 times 5. (reason: plug the input into the line)
- Multiply: 6 times 5 equals 30.
- Add: 52 plus 30 equals 82. So the predicted score is 82 points.
Key idea: in y-hat equals a plus b x, the slope b is the predicted change in y per one-unit rise in x, and the intercept a is the predicted y when x is 0.
Why "least squares"
For any line, each data point has a residual, the actual y minus the predicted y-hat, which is how far above (positive) or below (negative) the line the point sits. Read it aloud: a residual is "what really happened minus what the line guessed." The least-squares line is the one line that makes the sum of the squared residuals as small as possible. We square the residuals for the same reasons we squared deviations earlier: so positives and negatives do not cancel, and so big misses are penalized more. That single criterion picks out one unique best line, and it always passes through the point of averages, the pair (mean of x, mean of y).
Key idea: a residual is actual minus predicted, and the least-squares line minimizes the total squared residual.
How good is the line? r-squared and residual plots
The number r-squared (the coefficient of determination) is the square of the correlation and reports the fraction of the variation in y that the line explains, as a value between 0 and 1. If r equals 0.8 then r-squared equals 0.64, and we say "about 64 percent of the variation in exam scores is explained by the linear relationship with hours studied." The remaining 36 percent is due to everything else. Higher r-squared means the line accounts for more of the ups and downs in the response.
A subtler check is the residual plot, a scatterplot of the residuals against x. If a line fits well, the residuals should look like a formless random band around zero with no pattern. If instead you see a curve or a fan shape in the residuals, the straight-line model is the wrong shape for the data, even if r-squared is high. The residual plot is the honest judge of whether a line belongs at all.
Where people get stuck: reading a high r-squared as proof that a line is appropriate. It is not. A curved relationship can still give a fairly high r-squared while a residual plot screams "curve." Always check the residual plot for a pattern before you trust the line.
Key idea: r-squared is the fraction of the response's variation explained by the line, and a patternless residual plot confirms a line is the right model.
Extrapolation and outliers
A regression line is trustworthy only within the range of x-values you actually observed. Using it far beyond that range is extrapolation, and it is dangerous because there is no evidence the linear pattern continues out there. A line fit to children's ages and heights would absurdly predict a 3-meter adult if extended to age 40; growth is not linear forever. Also beware influential points: an outlier far out in the x-direction can single-handedly tilt the whole line, so one unusual observation deserves scrutiny before you draw conclusions.
Key idea: predict only within the observed range of x, since extrapolation assumes a pattern that may not hold.
Try it
A least-squares line predicting a car's price in thousands from its age in years is y-hat equals 30 minus 2.5x. (a) Interpret the slope. (b) Predict the price of a 6-year-old car. (c) Why would predicting the price of a 40-year-old car be unwise?
Worked answer: (a) for each additional year of age, the predicted price drops by 2.5 thousand dollars. (b) y-hat equals 30 minus 2.5 times 6 equals 30 minus 15 equals 15, so about 15 thousand dollars. (c) age 40 is far outside the data used to build the line (and would even predict a negative price, 30 minus 100 equals -70), so it is extrapolation, where the linear pattern almost certainly no longer holds.
Common misconceptions
Myth: a high r-squared proves the line is the right model. Reality: r-squared only measures how much variation is explained by a linear fit. A curved relationship can still show a fairly high r-squared, so the residual plot must be checked for a pattern.
Myth: a regression line can predict for any x-value. Reality: predictions are only reliable within the range of observed x. Extrapolating beyond that range assumes the pattern continues with no evidence that it does.
Myth: the slope tells you how strong the relationship is. Reality: the slope gives the rate of change in the response, but the strength of the linear relationship is measured by r (and r-squared), not by the size of the slope.
Recap
The least-squares regression line, y-hat equals a plus b x, predicts the response from the explanatory variable. Its slope is the predicted change in y per one-unit rise in x, stated in context, and its intercept is the predicted y when x is 0. The line minimizes the sum of squared residuals, where a residual is actual minus predicted, and it always passes through the point of averages. r-squared reports the fraction of the response's variation the line explains, while a residual plot reveals whether a line is even the right shape. Predict only within the observed range, because extrapolation is unreliable.
Sources
- OpenStax. (2023). The regression equation. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Introduction to linear regression and correlation. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Exploring bivariate numerical data. khanacademy.org
- Key terms
- Regression line
- The best-fit line y-hat equals a plus b x used to predict a response from an explanatory variable.
- Slope
- The predicted change in the response for each one-unit increase in the explanatory variable.
- Intercept
- The predicted response when the explanatory variable equals zero.
- Residual
- The actual response minus the predicted response, actual minus y-hat.
- Least-squares
- The criterion that chooses the line minimizing the sum of squared residuals.
- r-squared
- The fraction of the response's variation explained by the linear model; the square of r.
- Extrapolation
- Predicting outside the observed range of the explanatory variable, which is unreliable.
Module 4: Collecting Data Well
Where good data comes from: random sampling and survey design, the difference between observational studies and experiments, and the biases that quietly ruin a study.
Sampling and Surveys
- Explain why random sampling is the key to a trustworthy survey.
- Distinguish simple random, stratified, cluster, and systematic samples.
- Identify convenience, voluntary-response, undercoverage, and nonresponse bias.
The big picture
Every conclusion in the second half of this course rests on one fragile assumption: that the sample fairly represents the population. If the sample is skewed, no amount of clever math can fix it, because the numbers you compute will faithfully describe the wrong group. This lesson is about getting the data honestly in the first place. Its message is blunt and freeing: how you choose the sample matters more than how big it is. A small random sample beats a huge biased one every time.
Key idea: a conclusion is only as trustworthy as the sample it came from, and good sampling depends on randomness, not size.
Why randomness
The enemy of good sampling is bias, a systematic tendency to favor certain outcomes and miss others. Bias does not mean bad luck; it means the method itself leans one way every time you use it. The cure is random selection: letting chance, not human choice or convenience, decide who is in the sample. Randomness matters because it gives every individual a known, fair chance of being chosen, which keeps our personal preferences and hidden patterns from tilting the sample. It also lets us calculate exactly how much sample-to-sample variation to expect, which is the foundation of every confidence interval and test to come.
Key idea: random selection removes bias and lets us quantify uncertainty, which human-chosen samples cannot do.
Four random sampling designs
There is more than one honest way to bring randomness in, and each fits different situations:
- Simple random sample (SRS): every group of the chosen size has an equal chance of being the sample, like drawing names from a hat. It is the gold standard and the model our formulas assume.
- Stratified sample: split the population into homogeneous groups called strata (for example, by grade level), then take an SRS from each stratum. This guarantees every group is represented and often gives more precise estimates when the strata differ.
- Cluster sample: split the population into groups called clusters (for example, classrooms), randomly choose whole clusters, and measure everyone in them. It is cheaper when the population is naturally grouped and hard to list individually.
- Systematic sample: pick a random starting point, then take every kth individual (every 10th person on a list). Simple to carry out, and fine as long as the list has no hidden repeating pattern that lines up with k.
The distinction students most often blur is stratified versus cluster. In a stratified sample you take some members from every group; in a cluster sample you take all members from some groups. A memory hook: strata are sampled within, clusters are sampled whole.
Where people get stuck: confusing stratified and cluster sampling. Ask "did I take a few from each group, or everybody from a few groups?" The first is stratified, the second is cluster. Stratified aims to represent every subgroup on purpose; cluster is a cost-saving shortcut that treats each chosen group as a mini-population.
Key idea: stratified sampling takes some from every group; cluster sampling takes all from some groups.
Four biases that ruin a survey
When randomness is missing or the design is careless, specific biases creep in. These four appear constantly on the AP exam:
- Convenience sampling: choosing whoever is easiest to reach (the first people you see at a mall). They rarely represent the whole population.
- Voluntary-response bias: letting people opt in, as with call-in polls or online reviews. Those with strong opinions, often negative, are far more likely to respond, so the sample is skewed toward the passionate.
- Undercoverage: some groups are left out of the sampling process entirely, like surveying only landline phones and missing everyone who uses only a cell phone.
- Nonresponse bias: chosen people cannot be reached or refuse to answer, and if the non-responders differ from responders, the results tilt.
Two more quiet distorters are worth naming: response bias, where people answer untruthfully (out of embarrassment, or to please the interviewer), and question wording, where a leading or confusing question nudges the answer. "Do you support the sensible new safety law?" will draw more yeses than a neutral phrasing. A good survey guards against all of these.
Key idea: convenience, voluntary-response, undercoverage, and nonresponse bias all pull a survey away from the truth, and none is fixed by a larger sample.
The famous cautionary tale
In 1936 a magazine mailed millions of straw-poll ballots and predicted a landslide for the losing presidential candidate. Its enormous sample came from car registrations and telephone lists, which in the Depression skewed wealthy, a textbook case of undercoverage, and it relied on voluntary response. A far smaller but properly sampled poll got the winner right. The lesson has never aged: a giant biased sample is still biased, and size is no substitute for a fair method.
Try it
A principal wants to gauge student opinion. She has each homeroom teacher randomly pick 3 students to survey. (a) Name this sampling method. (b) A radio host instead invites listeners to call in their views. Name the most serious bias in the call-in approach.
Worked answer: (a) taking a few students from every homeroom is a stratified sample, with homerooms as strata (if instead she surveyed every student in a few randomly chosen homerooms, that would be cluster). (b) the call-in poll suffers from voluntary-response bias, because only listeners with strong opinions bother to call, so the sample overrepresents intense views.
Common misconceptions
Myth: a very large sample is automatically trustworthy. Reality: if the sampling method is biased, a bigger sample just gives a more precise wrong answer. A small random sample is more trustworthy than a huge convenience sample.
Myth: stratified and cluster sampling are basically the same. Reality: stratified sampling takes some members from every group to ensure representation; cluster sampling takes all members from a few randomly chosen groups to save cost. They differ in both purpose and result.
Myth: an online opt-in poll with thousands of responses reflects public opinion. Reality: opt-in polls suffer from voluntary-response bias, drawing people with the strongest feelings, so they can be wildly unrepresentative no matter the count.
Recap
A trustworthy survey depends on random selection, which removes bias and lets us quantify uncertainty; how you sample matters more than how many you sample. Four honest random designs are the simple random sample, stratified (some from every group), cluster (all from some groups), and systematic (every kth). When randomness fails, convenience, voluntary-response, undercoverage, and nonresponse biases distort the results, along with response bias and loaded question wording, and none of these is cured by a bigger sample.
Sources
- OpenStax. (2023). Data, sampling, and variation in data and sampling. In Introductory statistics 2e. openstax.org
- College Board. (2020). AP Statistics course and exam description (Unit 3: Collecting data). apcentral.collegeboard.org
- Khan Academy. (n.d.). Study design. khanacademy.org
- Key terms
- Bias
- A systematic tendency of a method to favor certain outcomes over others.
- Simple random sample (SRS)
- A sample in which every group of the chosen size is equally likely to be selected.
- Stratified sample
- A design that takes a random sample from within every subgroup (stratum) of the population.
- Cluster sample
- A design that randomly selects whole groups (clusters) and measures every member of them.
- Voluntary-response bias
- Bias from letting people opt in, overrepresenting those with strong opinions.
- Undercoverage
- Bias from leaving some groups out of the sampling process entirely.
- Nonresponse bias
- Bias arising when selected individuals cannot be reached or refuse to respond.
Experiments and Establishing Cause
- Distinguish an observational study from an experiment and say what each can conclude.
- Identify the treatments, control, randomization, and replication in an experiment.
- Explain how a control group, blinding, and a placebo guard against confounding.
The big picture
The last lesson showed how to gather a fair sample. This one asks a deeper question: how do we prove that something actually causes an effect, rather than merely being associated with it? The answer is the designed experiment, the only tool in all of statistics that can establish cause. Understanding why an experiment can do what an observational study cannot is one of the most powerful ideas you will take from this course, and it explains why medicine insists on clinical trials before trusting any treatment.
Key idea: only a randomized experiment can establish causation; observational studies can reveal association but not cause.
Observational study versus experiment
In an observational study, researchers watch and measure without intervening; they simply record what people already do. In an experiment, researchers actively impose a treatment on the subjects and observe the response. The difference is decisive. An observational study finding that coffee drinkers live longer cannot rule out that coffee drinkers also exercise more or smoke less, so a lurking variable might explain the link. An experiment that randomly assigns some people to drink coffee and others not can, if well designed, isolate coffee as the cause.
Where people get stuck: thinking a very large or careful observational study can prove cause. It cannot, ever, because a lurking variable can always hide inside self-selected groups. The word "cause" earns its place only after a randomized experiment. When you read "linked to" or "associated with" in a health headline, that is usually the honest signal of an observational study that cannot claim cause.
Key idea: experiments impose a treatment while observational studies only watch, and only imposing plus randomizing can isolate a cause.
The confounding problem
A confounding variable is one whose effect on the response is tangled up with the effect of the treatment, so you cannot tell which one did the work. Suppose a school gives a new tutoring program to students who sign up. If those students improve, was it the tutoring, or the fact that students who volunteer for tutoring are more motivated in the first place? Motivation is confounded with tutoring. Confounding is the reason observational studies cannot prove cause, and defeating it is the whole purpose of experimental design.
Key idea: confounding tangles a treatment's effect with another variable's effect, and good design exists to eliminate it.
The three principles of good design
A sound experiment rests on three pillars:
- Control: compare the treatment against a baseline, usually a control group that receives no treatment or a standard one. Without a comparison group you cannot know what would have happened anyway.
- Randomization: assign subjects to the groups by chance. This is the master stroke. Random assignment tends to balance out every lurking variable, known and unknown, across the groups, so the groups start out alike and any later difference can be credited to the treatment.
- Replication: use enough subjects (and, ideally, repeat the whole study). More subjects average out chance variation, so a real effect can be told apart from random noise.
Notice which principle does the causal magic: randomization. Random assignment (in experiments) is what licenses causal claims, just as random selection (in sampling) is what licenses generalizing to a population. They are cousins with different jobs, and top students keep them straight.
Key idea: control, randomization, and replication make an experiment sound, and it is random assignment that makes cause conclusions possible.
Placebos and blinding
People often improve simply because they believe they are being treated, a real effect called the placebo effect. To separate the treatment's true effect from belief, the control group receives a placebo, a dummy treatment indistinguishable from the real one (a sugar pill). Beyond that, an experiment should be blind: subjects do not know which group they are in, so their expectations do not skew the response. Better still is double-blind, where neither the subjects nor the people measuring the outcome know the assignments, so the researchers' hopes cannot color their measurements either. Blinding is why rigorous drug trials are double-blind, placebo-controlled, and randomized, the phrase that marks the strongest evidence in medicine.
Key idea: a placebo and blinding keep expectations from masquerading as a real treatment effect.
Try it
A researcher believes a new fertilizer boosts tomato yield. She has 40 identical plots. (a) Describe a completely randomized experiment. (b) Why is random assignment essential here?
Worked answer: (a) randomly assign 20 plots to receive the new fertilizer (treatment) and 20 to receive the usual fertilizer or none (control), grow them under the same conditions, then compare average yields. (b) random assignment balances lurking variables like soil quality and sunlight across the two groups, so any yield difference can be attributed to the fertilizer rather than to plots that happened to have better soil.
Common misconceptions
Myth: a large, careful observational study can prove causation. Reality: without random assignment, a lurking variable can always explain the association, so observational studies show association only, never cause.
Myth: the placebo effect is imaginary or unimportant. Reality: the placebo effect is a genuine, measurable response to the belief in treatment, which is exactly why a placebo control group is needed to isolate the treatment's true effect.
Myth: random sampling and random assignment are the same thing. Reality: random sampling (who is in the study) lets you generalize to a population; random assignment (which group each subject gets) lets you conclude cause. They serve different purposes.
Recap
Observational studies watch without intervening and can show association but not cause, because confounding variables can always lurk. An experiment imposes a treatment, and its three principles, control, randomization, and replication, make it sound. Random assignment is the key that balances lurking variables and licenses causal claims, just as random selection licenses generalization. A placebo and blinding (ideally double-blind) prevent expectations from imitating a real effect, which is why the strongest medical evidence comes from randomized, double-blind, placebo-controlled trials.
Sources
- OpenStax. (2023). Data, sampling, and variation in data and sampling. In Introductory statistics 2e. openstax.org
- College Board. (2020). AP Statistics course and exam description (Unit 3: Collecting data). apcentral.collegeboard.org
- Khan Academy. (n.d.). Study design. khanacademy.org
- Key terms
- Observational study
- A study that measures subjects without imposing a treatment; can show association but not cause.
- Experiment
- A study in which researchers impose a treatment and observe the response.
- Confounding variable
- A variable whose effect is tangled with the treatment's, obscuring the true cause.
- Control group
- A baseline group receiving no treatment or a standard one, for comparison.
- Randomization
- Assigning subjects to groups by chance to balance lurking variables.
- Placebo
- A dummy treatment indistinguishable from the real one, used to isolate the treatment effect.
- Double-blind
- A design in which neither subjects nor those measuring outcomes know the group assignments.
Module 5: Probability and Random Variables
The mathematics of chance: probability rules, conditional probability and independence, and random variables including the binomial model that counts successes.
Probability Rules and Conditional Probability
- Apply the complement, addition, and multiplication rules of probability.
- Compute and interpret conditional probability and test for independence.
- Use a two-way table or tree diagram to organize probability problems.
The big picture
To reason about samples, we need the language of chance. Probability is the mathematics of how likely things are, and it is the bridge between describing data (the first half of the course) and drawing conclusions from it (the second half). The good news is that most probability comes down to a few plain-English rules and careful counting. We will keep everything concrete with coins, dice, and cards, and read each rule aloud before we use it.
Key idea: probability measures how likely an event is, and it is the tool that connects data to inference.
What a probability is
The probability of an event is a number between 0 and 1 that says how likely it is: 0 means impossible, 1 means certain, and 0.5 means it happens about half the time. The law of large numbers gives this its meaning: over many, many repetitions, the fraction of times an event happens settles down to its true probability. Flip a fair coin ten times and you might get 7 heads, but flip it ten thousand times and the fraction of heads will be very close to 0.5. Probability is a long-run idea, not a promise about the next flip.
Key idea: a probability is a number from 0 to 1, and it describes the long-run fraction of times an event occurs.
The complement and addition rules
The complement rule says the probability an event does not happen is 1 minus the probability it does. Read aloud: "everything that is left over after the event is its opposite." If the probability of rain is 0.3, the probability of no rain is 1 minus 0.3 equals 0.7. This simple rule is often the fastest path to an answer, because "at least one" problems are usually easiest solved as 1 minus "none."
The addition rule handles "or." For any two events A and B, the probability of A or B equals P(A) plus P(B) minus P(A and B). You subtract the overlap so you do not count it twice. When the two events cannot happen together (they are mutually exclusive, or disjoint), the overlap is zero and it simplifies to just P(A) plus P(B). For a single die, the probability of rolling a 2 or a 5 is 1/6 plus 1/6 equals 2/6, because a roll cannot be both.
Key idea: the complement rule gives P(not A) equals 1 minus P(A), and the addition rule for "or" subtracts the overlap to avoid double counting.
Independence and the multiplication rule
Two events are independent if one happening does not change the probability of the other. Separate coin flips are independent; the coin has no memory. For independent events, the multiplication rule says the probability of A and B equals P(A) times P(B). Read aloud: "to get both independent things, multiply their chances." The probability of two heads in a row is 1/2 times 1/2 equals 1/4.
Worked example. A bag has 4 red and 6 blue marbles. You draw one, replace it, then draw again. Find the probability both are red.
- P(red) on one draw equals 4 out of 10 equals 0.4. (reason: 4 red among 10 total)
- Because you replaced the first marble, the draws are independent. (reason: replacement resets the bag)
- P(both red) equals 0.4 times 0.4 equals 0.16. (reason: multiplication rule for independent events)
Where people get stuck: using the simple multiplication rule when events are not independent. If you do not replace the first marble, the second draw's probability changes (now 3 red among 9), so P(both red) equals 0.4 times (3 divided by 9) equals 0.4 times 0.333 equals 0.133, not 0.16. Always ask "does the first event change the second?" before multiplying.
Key idea: events are independent when one does not affect the other, and only then does P(A and B) equal P(A) times P(B).
Conditional probability
Conditional probability is the probability of one event given that another has happened, written P(A given B). Read aloud: "the chance of A, once we know B is true." It is computed as P(A and B) divided by P(B), which just restricts attention to the world where B occurred. Conditional probability is how we update our beliefs with new information, and it is the engine behind medical test interpretation, spam filters, and much of inference.
Two-way tables make conditional probabilities easy. Suppose 100 students are classified by whether they exercise and whether they sleep well:
| Sleeps well | Sleeps poorly | Total | |
| Exercises | 40 | 10 | 50 |
| Does not | 20 | 30 | 50 |
| Total | 60 | 40 | 100 |
P(sleeps well given exercises) restricts to the 50 exercisers, of whom 40 sleep well, so it equals 40 divided by 50 equals 0.8. Compare P(sleeps well given does not exercise) equals 20 divided by 50 equals 0.4. Because these differ (0.8 versus 0.4), exercising and sleeping well are not independent; knowing someone exercises changes the probability they sleep well. That comparison, "is P(A given B) the same as P(A)?", is the practical test for independence.
Key idea: P(A given B) equals P(A and B) divided by P(B), and events are independent exactly when P(A given B) equals P(A).
Try it
Using the table above: (a) find P(exercises). (b) find P(exercises given sleeps poorly). (c) are exercising and sleeping poorly independent?
Worked answer: (a) 50 of 100 exercise, so P(exercises) equals 0.5. (b) restrict to the 40 who sleep poorly; 10 of them exercise, so P(exercises given sleeps poorly) equals 10 divided by 40 equals 0.25. (c) since 0.25 is not equal to 0.5, knowing a person sleeps poorly lowers the probability they exercise, so the events are not independent.
Common misconceptions
Myth: after several heads in a row, tails is "due" on the next flip. Reality: independent trials have no memory, so a fair coin's next flip is always 0.5 heads regardless of the streak. This is the gambler's fallacy.
Myth: you can always multiply probabilities to get "and." Reality: the simple rule P(A and B) equals P(A) times P(B) holds only when the events are independent. If one event changes the other, you must use the conditional probability instead.
Myth: P(A given B) equals P(B given A). Reality: these are usually different. The probability of a cough given the flu is high, but the probability of the flu given a cough is low, because most coughs are not flu.
Recap
A probability is a number from 0 to 1 describing the long-run fraction of times an event occurs. The complement rule gives P(not A) equals 1 minus P(A). The addition rule for "or" is P(A) plus P(B) minus their overlap, simplifying when events are mutually exclusive. The multiplication rule P(A and B) equals P(A) times P(B) holds only for independent events. Conditional probability P(A given B) equals P(A and B) divided by P(B) updates a probability with new information, and comparing P(A given B) with P(A) tests for independence. Two-way tables and tree diagrams keep it all organized.
Sources
- OpenStax. (2023). Terminology (probability). In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Introduction to probability topics. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Probability. khanacademy.org
- Key terms
- Probability
- A number from 0 to 1 giving the long-run fraction of times an event occurs.
- Complement rule
- P(not A) equals 1 minus P(A).
- Addition rule
- P(A or B) equals P(A) plus P(B) minus P(A and B).
- Mutually exclusive
- Two events that cannot both happen, so their overlap probability is zero.
- Independent events
- Events for which one occurring does not change the probability of the other.
- Multiplication rule
- For independent events, P(A and B) equals P(A) times P(B).
- Conditional probability
- P(A given B) equals P(A and B) divided by P(B); the probability of A once B is known.
Random Variables and the Binomial Distribution
- Find the mean (expected value) and standard deviation of a discrete random variable.
- Recognize a binomial setting and compute binomial probabilities.
- Find the mean and standard deviation of a binomial count.
The big picture
A random variable is simply a number produced by a chance process: the total on two dice, the number of heads in ten flips, tomorrow's rainfall. Giving chance outcomes a numerical value lets us compute an average outcome and a typical spread, exactly as we did for data, but now for the future. This lesson builds that machinery and then meets the most useful discrete model in the course, the binomial distribution, which counts successes in a fixed number of independent tries.
Key idea: a random variable attaches a number to a chance outcome, so we can find its average and spread.
Expected value: the mean of a random variable
A discrete random variable takes a list of values, each with a probability. Its expected value (or mean), written as the Greek letter mu, is the long-run average outcome. Read the rule aloud: "multiply each value by its probability, then add them all up." It is a weighted average, with probabilities as the weights.
Worked example. A carnival game pays as follows: you win 10 dollars with probability 0.1, win 2 dollars with probability 0.3, and win 0 dollars with probability 0.6. Find the expected winnings.
- Multiply each value by its probability: 10 times 0.1 equals 1.0; 2 times 0.3 equals 0.6; 0 times 0.6 equals 0. (reason: weight each payoff)
- Add them: 1.0 plus 0.6 plus 0 equals 1.6. (reason: sum the weighted values)
- So the expected winning is 1.60 dollars per play. (interpretation: over many plays you average 1.60 dollars, even though you never win exactly that on a single play)
Where people get stuck: expecting the expected value to be a possible outcome. It usually is not. You can never win exactly 1.60 dollars in that game, yet 1.60 is the correct long-run average per play. Expected value describes the average over many repetitions, not a prediction of any single result. If a play costs 2 dollars, the expected value of 1.60 tells you the game loses 0.40 dollars per play on average, which is how casinos and insurers stay in business.
Key idea: the expected value is the probability-weighted average of the outcomes, and it need not be an outcome you can actually get.
Standard deviation of a random variable
The standard deviation of a random variable measures the typical distance of outcomes from the mean, just as it did for data. You find the variance by taking each value's squared distance from mu, weighting each by its probability, and adding; then the standard deviation is the square root. A larger standard deviation means the outcomes swing more widely around the average, which matters enormously for risk: two bets with the same expected value can feel completely different if one is steady and the other wild.
Key idea: a random variable's standard deviation is the typical distance of its outcomes from the expected value.
The binomial setting
Many chance situations share the same skeleton, and when they do, one formula handles them all. A setting is binomial when four conditions hold, easy to remember as BINS:
- Binary: each trial is a success or a failure (two outcomes).
- Independent: trials do not affect each other.
- Number fixed: the number of trials n is set in advance.
- Same probability: the success probability p is the same on every trial.
Flipping a coin 20 times and counting heads is binomial (n equals 20, p equals 0.5). Drawing cards without replacement is not, because the probability changes and the trials are dependent. The binomial random variable X counts the number of successes in the n trials.
Key idea: a binomial setting has a fixed number of independent, two-outcome trials with a constant success probability, and X counts the successes.
Binomial mean and standard deviation
The binomial distribution has beautifully simple formulas for its center and spread. The mean number of successes is n times p. Read aloud: "expected successes equal the number of tries times the chance each try succeeds." The standard deviation is the square root of n times p times (1 minus p).
Worked example. A free-throw shooter makes 80 percent of shots and takes 25 shots. Find the mean and standard deviation of the number made.
- Mean: n times p equals 25 times 0.8 equals 20 made shots. (reason: expected successes)
- Variance: n times p times (1 minus p) equals 25 times 0.8 times 0.2 equals 4. (reason: binomial variance)
- Standard deviation: the square root of 4 equals 2 shots. (reason: return to original units)
So the shooter typically makes about 20 shots, give or take about 2. That "give or take 2" is what the standard deviation buys us: a sense of the ordinary range, roughly 18 to 22, worth of variation to expect.
Key idea: for a binomial count, the mean is n times p and the standard deviation is the square root of n times p times (1 minus p).
Binomial probabilities
To find the probability of an exact number of successes, the binomial probability formula multiplies three things: the number of ways to arrange k successes among n trials, the probability of k successes, and the probability of the remaining failures. In practice you will use a calculator's binomial function, but the idea is countable: list the arrangements, weight each by its chance. For "at least one" questions, remember the complement trick from the last lesson: P(at least one success) equals 1 minus P(no successes), which is almost always the fast route.
Key idea: binomial probabilities count the arrangements of successes and weight them, and "at least one" is easiest as 1 minus "none."
Try it
A multiple-choice quiz has 10 questions, each with 4 choices, and a student guesses every one. Let X be the number correct. (a) Is this binomial, and what are n and p? (b) Find the mean and standard deviation of X.
Worked answer: (a) yes: each question is right or wrong (binary), guesses are independent, there are a fixed 10 of them, and each has success probability p equals 1/4 equals 0.25, so n equals 10 and p equals 0.25. (b) mean equals n times p equals 10 times 0.25 equals 2.5 correct; variance equals 10 times 0.25 times 0.75 equals 1.875, so the standard deviation equals the square root of 1.875, about 1.37. A guesser typically gets about 2.5 right, give or take roughly 1.4.
Common misconceptions
Myth: the expected value is the most likely single outcome. Reality: the expected value is a long-run average and is often not even a possible outcome, like an average of 2.5 correct answers on a quiz.
Myth: any count of successes is binomial. Reality: all four BINS conditions must hold. Drawing without replacement breaks independence and a constant p, so it is not binomial.
Myth: a higher expected value always makes a bet better. Reality: spread matters too. Two bets with equal expected values can carry very different risk, which is exactly what the standard deviation measures.
Recap
A random variable assigns a number to a chance outcome. Its expected value (mu) is the probability-weighted average of the outcomes and need not be an achievable value; its standard deviation is the typical distance of outcomes from that mean. A binomial setting has a fixed number of independent, two-outcome trials with constant success probability (BINS), and the count of successes X has mean n times p and standard deviation the square root of n times p times (1 minus p). Binomial probabilities count and weight arrangements, and "at least one" is best found as 1 minus "none."
Sources
- OpenStax. (2023). Mean or expected value and standard deviation. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Binomial distribution. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Random variables. khanacademy.org
- Key terms
- Random variable
- A numerical value assigned to the outcome of a chance process.
- Expected value (mean)
- The probability-weighted average of a random variable's outcomes, written mu.
- Standard deviation (of a random variable)
- The typical distance of a random variable's outcomes from its mean.
- Binomial setting
- A fixed number of independent, two-outcome trials with a constant success probability (BINS).
- Binomial random variable
- The count X of successes in n binomial trials.
- Binomial mean
- The expected number of successes, equal to n times p.
- Binomial standard deviation
- The square root of n times p times (1 minus p).
Module 6: Sampling Distributions and Inference for Proportions
The bridge from a single sample to the whole population: sampling distributions and the Central Limit Theorem, then confidence intervals and significance tests for a proportion.
Sampling Distributions and the Central Limit Theorem
- Explain what a sampling distribution is and why sample statistics vary.
- State the Central Limit Theorem and describe the sampling distribution of a mean.
- Compute a standard error and explain why larger samples give more precise estimates.
The big picture
Here is the idea that makes all of inference possible, and it is genuinely beautiful. If you took a different random sample, you would get a slightly different sample mean. Do it again, and again, and the collection of all those possible sample means has its own predictable pattern, called a sampling distribution. Understanding that pattern is what lets us take one sample and still say something trustworthy about the whole population. This lesson is the bridge from describing data to drawing conclusions, so we will go slowly and lean on pictures.
Key idea: a statistic like the sample mean varies from sample to sample, and the pattern of that variation is the sampling distribution.
What varies, and why it is not a mistake
When we introduced statistics and parameters, we noted that a statistic estimates a parameter but rarely equals it exactly. Now we can say why: sampling variability. Each random sample includes different individuals, so each sample mean lands in a slightly different place. This variation is not an error to be fixed; it is a natural, quantifiable feature of random sampling. The genius of statistics is that random selection makes this variation predictable, so we can account for it rather than be fooled by it.
Imagine writing every possible sample mean of size n on its own slip and making a histogram of them. That histogram is the sampling distribution of the mean, and it has three features we can pin down: a center, a spread, and a shape.
Key idea: sampling variability is a natural, predictable consequence of random sampling, not a flaw.
Center and spread of the sample mean
Two facts describe where the sampling distribution of the mean sits and how wide it is. First, its center equals the population mean. In plain words: on average, the sample mean hits the true mean, neither systematically too high nor too low. A statistic with this property is called unbiased, and it is a very good thing.
Second, its spread, called the standard error of the mean, equals the population standard deviation divided by the square root of n. Read that aloud: "the sample means scatter less than the raw data, by a factor of the square root of the sample size." This is the single most important formula in inference, because it says larger samples give tighter, more precise estimates. Quadruple the sample size and you halve the standard error, since the square root of 4 is 2. Precision is buyable, but at a diminishing rate.
Worked example. A population has mean 50 and standard deviation 12. For samples of size n equals 36, describe the sampling distribution of the sample mean.
- Center: the mean of the sample means equals the population mean, 50. (reason: the sample mean is unbiased)
- Standard error: 12 divided by the square root of 36 equals 12 divided by 6 equals 2. (reason: population standard deviation over root n)
- So sample means of size 36 center at 50 and typically fall within about 2 of it. (interpretation: much tighter than the raw spread of 12)
Where people get stuck: confusing the standard deviation of the data with the standard error of the mean. The population standard deviation (here 12) describes how spread out individual values are. The standard error (here 2) describes how spread out sample means are, and it is always smaller, shrunk by the square root of n. Averages are steadier than individuals, which is the whole reason larger samples help.
Key idea: the sample mean is unbiased (centered at the population mean), and its standard error is the population standard deviation divided by the square root of n.
The Central Limit Theorem
Now the shape, and here is the near-magical part. The Central Limit Theorem (CLT) says that for a large enough sample size, the sampling distribution of the sample mean is approximately normal, no matter what shape the original population has. Read it aloud: "average enough values together, and the averages pile up into a bell, even if the raw data was lopsided." A wildly skewed population of incomes, averaged in samples of size 40, produces sample means that trace a lovely normal curve. A common rule of thumb is that a sample size of about 30 or more is usually enough, though very skewed populations need a bit more.
Why does this matter so much? Because it means we can use the normal model and z-scores from Module 2 to reason about sample means, even when we know nothing about the population's shape. Every confidence interval and significance test in the rest of the course is built on this one theorem. It is the reason a single random sample can tell us something reliable about an unknown world.
Key idea: the Central Limit Theorem says the sampling distribution of the mean is approximately normal for large n, regardless of the population's shape.
Try it
Household water use in a city is right-skewed with mean 300 liters per day and standard deviation 90. For random samples of 100 households: (a) what are the center and standard error of the sampling distribution of the sample mean? (b) what is its approximate shape, and why?
Worked answer: (a) the center equals the population mean, 300 liters; the standard error equals 90 divided by the square root of 100 equals 90 divided by 10 equals 9 liters. (b) although the population is skewed, n equals 100 is large, so by the Central Limit Theorem the sampling distribution of the mean is approximately normal, centered at 300 with a standard error of 9.
Common misconceptions
Myth: the Central Limit Theorem says the data becomes normal as you collect more of it. Reality: the population's shape never changes. It is the sampling distribution of the sample mean that becomes normal as the sample size grows.
Myth: the standard error and the population standard deviation are the same thing. Reality: the standard error is the population standard deviation divided by the square root of n, so it is smaller and describes the spread of sample means, not of individual values.
Myth: a bigger sample makes each individual value more accurate. Reality: a bigger sample makes the sample mean a more precise estimate of the population mean, by shrinking the standard error; individual measurements are unaffected.
Recap
A sampling distribution is the pattern of a statistic across all possible samples. The sample mean varies because of sampling variability, which random selection makes predictable. The sampling distribution of the mean is centered at the population mean (unbiased) and has a standard error equal to the population standard deviation divided by the square root of n, so larger samples give tighter estimates. The Central Limit Theorem adds that this distribution is approximately normal for large n regardless of the population shape, which is the foundation of all the inference to come.
Sources
- OpenStax. (2023). The central limit theorem for sample means (averages). In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Introduction to the central limit theorem. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Sampling distributions. khanacademy.org
- Key terms
- Sampling distribution
- The distribution of a statistic over all possible samples of a given size.
- Sampling variability
- The natural variation in a statistic from one random sample to another.
- Unbiased statistic
- A statistic whose sampling distribution is centered at the parameter it estimates.
- Standard error
- The standard deviation of a statistic's sampling distribution; for the mean, the population standard deviation over the square root of n.
- Central Limit Theorem
- For large n, the sampling distribution of the sample mean is approximately normal regardless of the population shape.
- Population mean
- The mean of the entire population, the center of the sample mean's sampling distribution.
- Precision
- How tightly an estimate clusters around the parameter; improved by shrinking the standard error.
Confidence Intervals for a Proportion
- Explain what a confidence interval estimates and what its confidence level means.
- Construct a confidence interval for a population proportion step by step.
- Interpret a confidence level correctly and avoid the classic misinterpretation.
The big picture
Now we finally do inference. A poll finds that 56 percent of a sample support a measure. The honest question is not "is the true support exactly 56 percent?" (it almost certainly is not) but "what range of values is plausible for the whole population?" A confidence interval answers exactly that: it is a range of believable values for an unknown parameter, built from a sample, together with a level of confidence in the method. This is the first of our two great inference tools, and it rests entirely on the sampling distribution from the last lesson.
Key idea: a confidence interval gives a range of plausible values for an unknown parameter, with a stated level of confidence.
The idea of a confidence interval
Because a sample statistic varies around the true parameter in a predictable way (the sampling distribution), we can reverse the logic: take our one statistic and cast a net around it wide enough to usually capture the parameter. A confidence interval has the form estimate plus or minus margin of error. The estimate is our sample statistic (here the sample proportion), and the margin of error is how far we reach on each side. A good analogy: the interval is a net thrown from a boat. You cannot see the fish (the parameter), but if your net-casting method catches it 95 percent of the time, you can be reasonably confident this particular cast did too.
Key idea: a confidence interval is "estimate plus or minus margin of error," a net cast around the sample statistic.
Building the margin of error
The margin of error for a proportion has two parts: a critical value that sets the confidence level, times the standard error that measures sampling variability. Read it aloud: "reach out a certain number of standard errors, where the number depends on how confident you want to be." For 95 percent confidence the critical value is about 1.96 (from the normal curve, since 95 percent of a normal distribution lies within 1.96 standard deviations of center). The standard error of a sample proportion is the square root of p-hat times (1 minus p-hat) divided by n, where p-hat is the sample proportion.
So the 95 percent confidence interval for a proportion is p-hat plus or minus 1.96 times the square root of p-hat times (1 minus p-hat) over n. Before using it, we check conditions: the data should come from a random sample, and there should be at least about 10 successes and 10 failures so the normal model applies.
Worked example. In a random sample of 400 voters, 240 support a measure. Build a 95 percent confidence interval for the true proportion of supporters.
- Sample proportion: p-hat equals 240 divided by 400 equals 0.60. (reason: successes over sample size)
- Check conditions: 240 successes and 160 failures both exceed 10, and the sample is random, so the normal model is fine.
- Standard error: the square root of (0.60 times 0.40 divided by 400) equals the square root of (0.24 divided by 400) equals the square root of 0.0006, which is about 0.0245. (reason: proportion standard error)
- Margin of error: 1.96 times 0.0245 equals about 0.048. (reason: critical value times standard error)
- Interval: 0.60 plus or minus 0.048, which is 0.552 to 0.648. (reason: estimate plus or minus margin)
So we are 95 percent confident that between about 55.2 percent and 64.8 percent of all voters support the measure. Notice the interval comfortably excludes 0.50, which hints the measure has real majority support, an idea we will formalize with hypothesis tests next.
Key idea: the margin of error is the critical value (about 1.96 for 95 percent) times the standard error, and the interval is the sample proportion plus or minus that margin.
What the confidence level really means
This is the most misunderstood idea in all of statistics, so we will state it with great care. "95 percent confident" refers to the method, not to any single interval. It means that if we repeated this whole sampling-and-interval process many times, about 95 percent of the intervals we built would contain the true parameter. For our one specific interval (0.552 to 0.648), the true proportion is either in it or it is not; there is no probability left to assign to that fixed interval. The confidence is in the long-run success rate of the procedure that produced it.
Where people get stuck: saying "there is a 95 percent probability that the true proportion is between 0.552 and 0.648." That is the classic error. The true proportion is a fixed (if unknown) number, and the interval is now fixed too, so it either does or does not contain it, 100 percent or 0 percent, not 95. The 95 percent describes how often the method works across many samples, not the chance for this one interval. Train yourself to say "we are 95 percent confident" and to mean "this came from a method that captures the truth 95 percent of the time."
Key idea: the confidence level is the long-run capture rate of the method, not the probability that a particular interval contains the parameter.
What changes the width
Two levers control the width of a confidence interval, and both make intuitive sense. Higher confidence means a wider interval: to be surer of catching the fish, you need a bigger net (a 99 percent interval is wider than a 95 percent one). Larger samples mean a narrower interval: more data shrinks the standard error, tightening the estimate. There is an unavoidable trade-off between confidence and precision at a fixed sample size, and the only way to get both high confidence and a narrow interval is to collect more data.
Key idea: higher confidence widens an interval and a larger sample narrows it, so precision and confidence trade off unless you gather more data.
Try it
In a random sample of 500 adults, 150 say they exercise daily. (a) Find the sample proportion. (b) Construct a 95 percent confidence interval. (c) Interpret it in one sentence.
Worked answer: (a) p-hat equals 150 divided by 500 equals 0.30. (b) standard error equals the square root of (0.30 times 0.70 divided by 500) equals the square root of (0.21 divided by 500) equals the square root of 0.00042, about 0.0205; margin equals 1.96 times 0.0205, about 0.040; interval equals 0.30 plus or minus 0.040, or 0.260 to 0.340. (c) we are 95 percent confident that between about 26 percent and 34 percent of all adults exercise daily, meaning this interval came from a method that captures the true proportion 95 percent of the time.
Common misconceptions
Myth: there is a 95 percent probability that the true parameter lies in this particular interval. Reality: once computed, the interval either contains the fixed parameter or it does not. The 95 percent describes the long-run success rate of the method, not this one interval.
Myth: a 95 percent confidence interval contains 95 percent of the data. Reality: it estimates a range for a parameter (like the mean or proportion), not a range that holds most individual data values. Those are entirely different ideas.
Myth: you can shrink the interval for free by lowering the confidence level. Reality: lowering confidence does narrow the interval, but at the cost of being right less often. Genuine precision without losing confidence requires a larger sample.
Recap
A confidence interval estimates an unknown parameter as an estimate plus or minus a margin of error. For a proportion, the margin is a critical value (about 1.96 for 95 percent) times the standard error, the square root of p-hat times (1 minus p-hat) over n, valid when the sample is random with at least about 10 successes and 10 failures. The confidence level describes the long-run capture rate of the method, never the probability for a single fixed interval. Higher confidence widens the interval and larger samples narrow it, so precision and confidence trade off unless you collect more data.
Sources
- OpenStax. (2023). A population proportion. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Introduction to confidence intervals. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Inference for categorical data (proportions). khanacademy.org
- Key terms
- Confidence interval
- A range of plausible values for a parameter, of the form estimate plus or minus margin of error.
- Margin of error
- The critical value times the standard error, the reach on each side of the estimate.
- Confidence level
- The long-run proportion of such intervals that capture the true parameter.
- Critical value
- A multiplier from the normal (or t) curve setting the confidence level, about 1.96 for 95 percent.
- Sample proportion (p-hat)
- The fraction of successes in the sample, used to estimate the population proportion.
- Standard error of a proportion
- The square root of p-hat times (1 minus p-hat) divided by n.
- Success-failure condition
- The requirement of at least about 10 successes and 10 failures for the normal model.
Significance Tests for a Proportion
- State null and alternative hypotheses for a claim about a proportion.
- Compute a test statistic and p-value and make a decision at a chosen significance level.
- Interpret a p-value correctly and distinguish Type I from Type II errors.
The big picture
Our second great inference tool asks a yes-or-no question: is an observed result real, or could it easily be just chance? A significance test (hypothesis test) weighs the evidence in a sample against a specific claim. If a coin lands heads 60 times in 100 flips, is it a biased coin, or is 60 within the ordinary wobble of a fair one? The test gives a principled answer built on the sampling distribution and the p-value, a number that captures "how surprised should I be?"
Key idea: a significance test decides whether a sample result is strong evidence against a specific claim or just plausible chance variation.
The two hypotheses
Every test pits two claims against each other. The null hypothesis (written H-zero) is the skeptical default, the "nothing special is happening" claim, usually an equality like "the proportion is 0.5." The alternative hypothesis (written H-a) is what we suspect instead, the "something is going on" claim, like "the proportion is greater than 0.5." We assume the null is true and ask whether the data is too surprising to square with it. This mirrors a courtroom: the null is "innocent," and we only reject it if the evidence is strong beyond reasonable doubt.
The alternative can be one-sided (greater than, or less than) or two-sided (not equal to), depending on the question. "Has support changed?" is two-sided; "has support increased?" is one-sided. Decide which before seeing the data.
Key idea: the null hypothesis is the skeptical default of no effect, and the alternative is the effect we suspect; we assume the null and test whether the data contradicts it.
The test statistic and the p-value
Assuming the null is true, the sample proportion has a known sampling distribution (approximately normal, from the Central Limit Theorem). We convert our result to a test statistic, a z-score measuring how many standard errors the sample proportion falls from the null value. Read it aloud: "how far, in standard errors, is what we saw from what the null predicted?" The formula is z equals (p-hat minus the null proportion) divided by the standard error computed with the null proportion.
From that z-score we get the p-value: the probability, if the null were true, of getting a result at least as extreme as the one observed. This is the single most important and most misunderstood number in statistics. Read it as "how surprised would I be to see data like this if nothing were really going on?" A small p-value means the data would be very surprising under the null, which is evidence against the null. A large p-value means the data is unremarkable under the null, so there is no reason to abandon it.
Worked example. A coin is flipped 100 times and lands heads 62 times. Test whether it is biased toward heads (null: p equals 0.5; alternative: p greater than 0.5).
- Sample proportion: p-hat equals 62 divided by 100 equals 0.62. (reason: successes over trials)
- Standard error under the null: the square root of (0.5 times 0.5 divided by 100) equals the square root of (0.25 divided by 100) equals the square root of 0.0025 equals 0.05. (reason: use the null proportion 0.5)
- Test statistic: z equals (0.62 minus 0.50) divided by 0.05 equals 0.12 divided by 0.05 equals 2.4. (reason: standard errors from the null)
- p-value: the probability a normal z exceeds 2.4 is about 0.008. (reason: one-sided area beyond z equals 2.4)
A p-value of 0.008 means that if the coin were truly fair, results this extreme would happen less than 1 percent of the time. That is strong evidence against fairness.
Key idea: the test statistic is a z-score measuring distance from the null in standard errors, and the p-value is the chance of a result this extreme if the null were true.
Making a decision
We compare the p-value to a preset threshold called the significance level, alpha, most often 0.05. If the p-value is less than or equal to alpha, we reject the null hypothesis and say the result is statistically significant. If the p-value is greater than alpha, we fail to reject the null, meaning the evidence is not strong enough. In the coin example, 0.008 is less than 0.05, so we reject the null and conclude the coin appears biased toward heads.
Where people get stuck: two traps. First, "fail to reject" is not the same as "prove the null true." We never accept the null; absence of strong evidence is not evidence of absence. Second, the p-value is not the probability that the null is true. It is the probability of the data given the null, which is a very different conditional. Say to yourself: "the p-value assumes the null and asks about the data, not the other way around."
Key idea: reject the null when the p-value is at most alpha; otherwise fail to reject, which never proves the null true.
Two kinds of error
Because we decide under uncertainty, two mistakes are possible. A Type I error is rejecting a true null, a false alarm (convicting an innocent coin of bias). Its probability is exactly alpha, the significance level we chose. A Type II error is failing to reject a false null, a miss (letting a truly biased coin pass as fair). Lowering alpha guards against false alarms but makes misses more likely, and vice versa, so the choice of alpha reflects which error is worse in context. In medical screening a miss may be deadly, while in a courtroom a false conviction is the graver wrong, and the threshold is set accordingly.
Key idea: a Type I error is a false alarm (rejecting a true null, probability alpha) and a Type II error is a miss (failing to reject a false null); reducing one tends to increase the other.
Try it
A company claims 90 percent of customers are satisfied. A consumer group samples 200 customers and finds 168 satisfied, suspecting the true rate is below 90 percent. (a) State the hypotheses. (b) Find p-hat and the test statistic. (c) With a p-value of about 0.06 and alpha equals 0.05, what is the decision?
Worked answer: (a) null: p equals 0.90; alternative: p less than 0.90 (one-sided). (b) p-hat equals 168 divided by 200 equals 0.84; standard error under the null equals the square root of (0.90 times 0.10 divided by 200) equals the square root of (0.09 divided by 200) equals the square root of 0.00045, about 0.0212; z equals (0.84 minus 0.90) divided by 0.0212 equals -0.06 divided by 0.0212, about -2.83. (c) if the reported p-value is 0.06, then since 0.06 is greater than 0.05 we fail to reject the null; the evidence is suggestive but not quite strong enough at the 0.05 level. (Note: a z of -2.83 would actually give a smaller p-value; treat the stated 0.06 as given for the decision practice, and always let the p-value versus alpha comparison drive the conclusion.)
Common misconceptions
Myth: the p-value is the probability that the null hypothesis is true. Reality: the p-value is the probability of data as extreme as observed assuming the null is true, a conditional in the opposite direction. It says nothing directly about the probability of the null.
Myth: failing to reject the null proves the null is true. Reality: it only means the evidence was insufficient to reject it. Absence of strong evidence is not evidence of absence.
Myth: a statistically significant result is automatically large or important. Reality: significance means the result is unlikely to be pure chance, not that the effect is big. A tiny, unimportant effect can be significant with a huge sample.
Recap
A significance test pits a skeptical null hypothesis against an alternative. Assuming the null, we compute a test statistic (a z-score of how far the sample proportion falls from the null in standard errors) and a p-value (the chance of a result this extreme if the null were true). We reject the null when the p-value is at most the significance level alpha, and fail to reject otherwise, never proving the null true. A Type I error is a false alarm with probability alpha, and a Type II error is a miss; reducing one usually increases the other. Crucially, a p-value is not the probability the null is true, and significance is not the same as importance.
Sources
- OpenStax. (2023). Null and alternative hypotheses. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Outcomes and the Type I and Type II errors. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Inference for categorical data (proportions). khanacademy.org
- Key terms
- Null hypothesis
- The skeptical default claim of no effect, usually an equality, assumed true during the test.
- Alternative hypothesis
- The claim of an effect that the researcher suspects, one-sided or two-sided.
- Test statistic
- A z-score measuring how many standard errors the sample statistic falls from the null value.
- p-value
- The probability, if the null were true, of a result at least as extreme as the one observed.
- Significance level (alpha)
- The preset threshold, often 0.05, for rejecting the null; also the Type I error rate.
- Type I error
- Rejecting a true null hypothesis, a false alarm, with probability alpha.
- Type II error
- Failing to reject a false null hypothesis, a missed real effect.
Module 7: Inference for Means, Chi-Square, and the AP Exam
Inference for quantitative data with t-procedures, chi-square tests for counts, and a full guided tour of how to earn points on the AP Statistics exam.
Inference for Means: The t-Procedures
- Explain why the t-distribution replaces the normal when the population standard deviation is unknown.
- Construct a confidence interval and run a significance test for a mean.
- Choose the correct t-procedure among one-sample, two-sample, and paired settings.
The big picture
We built confidence intervals and tests for proportions. Now we do the same for means, the center of quantitative data, which covers a huge range of real questions: average blood pressure, mean test score, typical wait time. The logic is identical to what you already know, with one honest twist. In the real world we almost never know the population standard deviation, so we estimate it from the sample, and that extra uncertainty forces us to swap the normal curve for a close cousin, the t-distribution. Everything else you have learned carries straight over.
Key idea: inference for means mirrors inference for proportions, but because the population standard deviation is unknown, we use the t-distribution.
Why t instead of z
When we standardized a sample mean before, the standard error used the population standard deviation. But we rarely know it, so we plug in the sample standard deviation s instead. That substitution adds uncertainty, because s itself wobbles from sample to sample. To account for it, William Gosset (writing as "Student") introduced the t-distribution: bell-shaped and symmetric like the normal, but with slightly heavier tails that make our intervals a touch wider and our tests a touch more cautious, honestly reflecting that we are estimating the spread too.
The t-distribution's exact shape depends on the degrees of freedom, which for a single sample is n minus 1. With few degrees of freedom the tails are noticeably heavy; as the sample grows, the t-distribution slides closer and closer to the normal, until for large n they are nearly identical. In plain words: small samples pay a larger "uncertainty tax," and that tax shrinks as data accumulates.
Where people get stuck: using z when the population standard deviation is unknown. The rule is simple. If you are working with a mean and had to compute s from the data (which is essentially always), use t with n minus 1 degrees of freedom, not z. Reserve z for proportions and for the rare case where the population standard deviation is genuinely known.
Key idea: replacing the unknown population standard deviation with the sample s requires the heavier-tailed t-distribution with n minus 1 degrees of freedom.
A confidence interval for a mean
The interval keeps the familiar form: the sample mean plus or minus a margin of error, where the margin is a t critical value times the standard error of the mean. The standard error is now s divided by the square root of n. Conditions to check: a random sample, and either a roughly normal population or a large enough sample for the Central Limit Theorem to smooth things out.
Worked example. A random sample of 25 batteries has a mean life of 40 hours and a sample standard deviation of 5 hours. Build a 95 percent confidence interval for the true mean life. (For 24 degrees of freedom, the t critical value is about 2.064.)
- Standard error: s over the square root of n equals 5 divided by the square root of 25 equals 5 divided by 5 equals 1 hour. (reason: sample standard deviation over root n)
- Margin of error: t critical value times standard error equals 2.064 times 1 equals 2.064 hours. (reason: reach out t standard errors)
- Interval: 40 plus or minus 2.064, which is about 37.94 to 42.06 hours. (reason: mean plus or minus margin)
So we are 95 percent confident the true mean battery life is between about 37.9 and 42.1 hours, meaning this method captures the true mean 95 percent of the time. Notice the t value 2.064 is a bit larger than the normal's 1.96, the small "uncertainty tax" for a sample of only 25.
Key idea: a mean's confidence interval is the sample mean plus or minus a t critical value times s over the square root of n.
A significance test for a mean
The test also parallels the proportion case. State hypotheses about the population mean (for example, null: the mean equals 500; alternative: the mean is greater than 500). Compute the t statistic: t equals (sample mean minus the null mean) divided by the standard error s over the square root of n. Read aloud: "how many estimated standard errors is our sample mean from the value the null claims?" Find the p-value from the t-distribution with n minus 1 degrees of freedom, compare it to alpha, and decide exactly as before, reject if the p-value is at most alpha, otherwise fail to reject.
Worked example. A class of 16 students has a mean score of 530 with sample standard deviation 40. Test whether the class mean exceeds the national average of 500 (alternative: greater than 500).
- Standard error: 40 divided by the square root of 16 equals 40 divided by 4 equals 10. (reason: s over root n)
- t statistic: (530 minus 500) divided by 10 equals 30 divided by 10 equals 3.0, with 15 degrees of freedom. (reason: distance from the null in standard errors)
- A t of 3.0 with 15 degrees of freedom gives a one-sided p-value of about 0.004. (reason: small tail area)
- Since 0.004 is less than 0.05, reject the null: strong evidence the class mean exceeds 500. (reason: p-value at most alpha)
Key idea: the one-sample t test uses t equals (sample mean minus null mean) over s divided by the square root of n, judged against the t-distribution.
Which t-procedure? One-sample, two-sample, paired
The AP exam loves to test whether you can pick the right procedure. Three cases cover most situations:
- One-sample t: one group compared to a fixed known value (this class versus the national average of 500).
- Two-sample t: two separate, independent groups compared to each other (a drug group versus a distinct placebo group). The two sets of people are unrelated.
- Paired t: two measurements on the same subjects, or on naturally matched pairs (each patient's blood pressure before and after treatment). Here you analyze the differences within each pair, turning it back into a one-sample t on those differences.
The distinction students most often miss is two-sample versus paired. Ask "are the two columns of numbers linked person by person?" If yes (before and after on the same people), it is paired; if no (two different groups of people), it is two-sample. Getting this wrong changes the whole calculation.
Key idea: use one-sample t against a fixed value, two-sample t for two independent groups, and paired t when the same subjects are measured twice.
Try it
A researcher records each of 10 runners' times before and after a training program and wants to know if times improved. Which t-procedure applies, and what do you analyze?
Worked answer: this is a paired t-procedure, because the two times are linked runner by runner (same people, before and after). You compute each runner's difference (before minus after), then run a one-sample t test on those 10 differences against a null mean difference of 0. It would be wrong to treat the before and after columns as two independent groups.
Common misconceptions
Myth: you use the normal (z) distribution for means. Reality: because the population standard deviation is almost always unknown and estimated by s, means use the t-distribution with n minus 1 degrees of freedom, not z.
Myth: two-sample and paired t-tests are interchangeable. Reality: paired data links measurements within each subject or matched pair, and must be analyzed as differences; two-sample data comes from independent groups. The choice changes the standard error and the result.
Myth: the t-distribution is completely different from the normal. Reality: it is the same bell shape with slightly heavier tails, and it converges to the normal as the sample grows, so for large n the two give nearly identical answers.
Recap
Inference for means copies the logic of proportions but uses the t-distribution, because we estimate the unknown population standard deviation with the sample s, adding uncertainty captured by n minus 1 degrees of freedom. A confidence interval is the sample mean plus or minus a t critical value times s over the square root of n. A one-sample t test uses t equals (sample mean minus null mean) over that same standard error, judged against the t-distribution. Choose one-sample t for a comparison to a fixed value, two-sample t for two independent groups, and paired t when the same subjects are measured twice, analyzing the within-pair differences.
Sources
- OpenStax. (2023). A single population mean using the normal distribution. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Introduction to hypothesis testing with one sample. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Inference for quantitative data (means). khanacademy.org
- Key terms
- t-distribution
- A bell-shaped distribution with heavier tails than the normal, used when the population standard deviation is unknown.
- Degrees of freedom
- A parameter setting the t-distribution's shape; n minus 1 for a single sample.
- Standard error of the mean
- The sample standard deviation s divided by the square root of n.
- One-sample t test
- A test comparing one sample mean to a fixed known value.
- Two-sample t test
- A test comparing the means of two independent groups.
- Paired t test
- A test on the differences within matched pairs or repeated measures on the same subjects.
- t statistic
- (Sample mean minus null mean) divided by the standard error s over the square root of n.
Chi-Square Tests for Counts
- Explain what a chi-square test compares and when to use each version.
- Compute expected counts and the chi-square statistic step by step.
- Interpret the chi-square statistic and its degrees of freedom to reach a conclusion.
The big picture
Proportion and mean tests handle one or two groups. But often we have categorical data in many groups at once: a die with six faces, a survey with five response options, a two-way table of preference by age group. The chi-square test is built for exactly this. It compares the counts we actually observed against the counts we would expect if some simple claim were true, and measures how far apart they are. It is the natural finale of our inference toolkit, extending everything you know to full tables of counts.
Key idea: a chi-square test compares observed counts in categories against the counts expected under a claim, for categorical data with several groups.
The core idea: observed versus expected
Every chi-square test rests on one comparison: observed counts (what the data shows) against expected counts (what we would see on average if the null hypothesis were true). If the observed and expected counts are close, the data agrees with the null and the statistic is small. If they are far apart, the data contradicts the null and the statistic is large. The whole test is a disciplined way of asking "are these categories farther from expectation than chance alone would produce?"
The chi-square statistic adds up, over every category, the quantity (observed minus expected) squared, divided by expected. Read it aloud: "for each category, take how far off you were, square it, scale it by how many you expected, and total these up." Squaring keeps every term positive and magnifies big misses; dividing by the expected count fairly weights a miss of 5 against a backdrop of 10 more heavily than the same miss against a backdrop of 1000.
Key idea: the chi-square statistic sums (observed minus expected) squared over expected across all categories, so it grows when observed counts stray from expectation.
Three flavors of chi-square test
The same statistic serves three related questions:
- Goodness of fit: does one categorical variable match a claimed distribution? (Is a die fair, so each face has probability one sixth?)
- Independence: in a two-way table from one sample, are the two categorical variables associated? (Is favorite genre related to age group?)
- Homogeneity: do several populations share the same distribution of one categorical variable? (Do three schools have the same breakdown of grades?)
Independence and homogeneity use the same arithmetic on a two-way table; they differ only in how the data was gathered (one sample split two ways versus several separate samples). Goodness of fit works on a single row of category counts.
Key idea: chi-square comes in goodness-of-fit, independence, and homogeneity versions, all using the same observed-versus-expected statistic.
Worked example: is the die fair?
A die is rolled 60 times with these observed counts: face 1 appears 8 times, face 2 appears 12, face 3 appears 9, face 4 appears 11, face 5 appears 10, face 6 appears 10. Test goodness of fit to a fair die.
- Expected count per face: if fair, each face has probability one sixth, so expected equals 60 times one sixth equals 10 for every face. (reason: total times the claimed probability)
- Compute (observed minus expected) squared over expected for each face:
| Face | 1 | 2 | 3 | 4 | 5 | 6 |
| Observed | 8 | 12 | 9 | 11 | 10 | 10 |
| Expected | 10 | 10 | 10 | 10 | 10 | 10 |
| (O minus E) squared / E | 0.4 | 0.4 | 0.1 | 0.1 | 0 | 0 |
- For face 1: (8 minus 10) squared over 10 equals 4 over 10 equals 0.4. Face 2: (12 minus 10) squared over 10 equals 0.4. Face 3: (9 minus 10) squared over 10 equals 0.1. Face 4: (11 minus 10) squared over 10 equals 0.1. Faces 5 and 6: 0 each.
- Sum: 0.4 plus 0.4 plus 0.1 plus 0.1 plus 0 plus 0 equals 1.0. So the chi-square statistic is 1.0. (reason: total across categories)
- Degrees of freedom: for goodness of fit, the number of categories minus 1 equals 6 minus 1 equals 5. (reason: categories minus one)
A chi-square statistic of 1.0 with 5 degrees of freedom is very small; the critical value at the 0.05 level for 5 degrees of freedom is about 11.07, and 1.0 is nowhere near it. So we fail to reject the null: these results are completely consistent with a fair die. The tiny statistic reflects observed counts hugging their expected value of 10.
Where people get stuck: forgetting that chi-square always uses counts, never percentages or proportions. If a problem gives you percentages, convert them back to raw counts before computing expected values, or the statistic will be meaningless. Chi-square is a test about how many, not what fraction.
Key idea: for goodness of fit, expected equals total times claimed probability, degrees of freedom equal categories minus 1, and the test always uses raw counts.
Degrees of freedom for two-way tables
For a two-way table, the degrees of freedom are (number of rows minus 1) times (number of columns minus 1), and each cell's expected count is its row total times its column total, divided by the grand total. Read that expected-count rule aloud: "if the two variables were unrelated, a cell's share would just be its row's share times its column's share of the whole." A large chi-square statistic then means the observed table departs from what independence predicts, which is evidence of an association.
Key idea: a two-way table has (rows minus 1) times (columns minus 1) degrees of freedom, and each expected count is row total times column total over the grand total.
Reading the result
A chi-square statistic is always zero or positive, and only its upper tail matters: small values mean good agreement with the null, large values mean poor agreement. We compare the statistic to a critical value (or find a p-value) for the right degrees of freedom, then decide just as in any test, reject the null if the statistic is large enough (p-value at most alpha), otherwise fail to reject. One caution: chi-square tests need reasonably large expected counts (a common rule is every expected count at least 5) for the approximation to hold.
Try it
A four-sided spinner is spun 40 times, so each side is expected 10 times if fair. Observed counts are 12, 9, 8, 11. Compute the chi-square statistic and its degrees of freedom.
Worked answer: each expected count is 40 times one fourth equals 10. Contributions: (12 minus 10) squared over 10 equals 0.4; (9 minus 10) squared over 10 equals 0.1; (8 minus 10) squared over 10 equals 0.4; (11 minus 10) squared over 10 equals 0.1. Sum equals 0.4 plus 0.1 plus 0.4 plus 0.1 equals 1.0. Degrees of freedom equal 4 minus 1 equals 3. Since the 0.05 critical value for 3 degrees of freedom is about 7.81 and 1.0 is far below it, the spinner looks fair.
Common misconceptions
Myth: chi-square can be computed from percentages or proportions. Reality: the statistic requires raw observed and expected counts. Feeding it percentages gives a meaningless result, so always convert back to counts first.
Myth: a chi-square statistic can be negative if observed is below expected. Reality: every term is a squared difference divided by a positive expected count, so the statistic is always zero or positive; only large positive values signal a mismatch.
Myth: a significant chi-square test tells you which category caused the difference. Reality: the test only signals that observed and expected differ overall. Finding which cells drive it requires examining the individual contributions separately.
Recap
A chi-square test compares observed counts against the counts expected under a null claim, summing (observed minus expected) squared over expected across all categories, so the statistic grows as the data strays from expectation. Goodness of fit tests one variable against a claimed distribution (degrees of freedom equal categories minus 1); independence and homogeneity work on two-way tables with (rows minus 1) times (columns minus 1) degrees of freedom and expected counts of row total times column total over the grand total. The statistic is always nonnegative, only its upper tail matters, it always uses raw counts, and it needs expected counts of at least about 5.
Sources
- OpenStax. (2023). Test of independence. In Introductory statistics 2e. openstax.org
- OpenStax. (2023). Introduction to the chi-square distribution. In Introductory statistics 2e. openstax.org
- Khan Academy. (n.d.). Chi-square tests for categorical data. khanacademy.org
- Key terms
- Chi-square test
- A test comparing observed category counts against counts expected under a null claim.
- Observed count
- The actual number of cases in a category from the data.
- Expected count
- The number of cases expected in a category if the null hypothesis were true.
- Chi-square statistic
- The sum over categories of (observed minus expected) squared divided by expected.
- Goodness-of-fit test
- A chi-square test of whether one categorical variable matches a claimed distribution.
- Test of independence
- A chi-square test of whether two categorical variables in a two-way table are associated.
- Degrees of freedom (chi-square)
- Categories minus 1 for goodness of fit, or (rows minus 1) times (columns minus 1) for a table.