📊 Data Science & Statistics · Undergraduate · STAT 201

Introduction to Statistics

An introductory course in statistical reasoning, with prerequisites of basic algebra, percentages, and graph reading. The course connects study design to the conclusions data can support. Every lesson includes worked feedback, relevant charts, and source references. Later lessons use freely available R, with commands and interpretation explained. A cumulative final and a data-analysis portfolio…

Start the interactive course (quizzes, progress, videos) →

Free forever. No sign-up, no ads. 19 lessons. The full lesson text is below so you can read it right here.

Module 1: Data and How We Picture It

Define measurements, read distributions, and connect sampling and assignment to the conclusions a study can support.

What Statistics Is, and Types of Data

  • Distinguish a population from a sample and a parameter from a statistic.
  • Classify a variable as categorical or quantitative.
  • Name the four levels of measurement with an example of each.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

Hand someone a spreadsheet of raw numbers, and what can they actually tell you? On their own, not much. Raw numbers are noisy and partial, and data almost never speaks for itself. Statistics is the science that makes it speak: collecting, organizing, summarizing, and drawing conclusions from data. Every field that gathers evidence, from medicine to economics to sports, leans on it. It splits into two branches.

Descriptive statistics summarizes what a dataset shows using tables, graphs, and numbers, without reaching beyond the data in hand. Inferential statistics uses a sample to make claims about the larger group it came from, always attaching a measure of uncertainty. This whole course is a journey from the first branch to the second: Modules 1 and 2 describe data, and Modules 3 through 5 use it to infer.

One dataset runs through this lesson. The Maple Street Clinic intake survey records four things about every patient who walks in: blood type, a pain rating from 1 to 10, body temperature in degrees Celsius, and annual income in dollars. The clinic has about 4,000 registered patients, and the survey covers 200 of them. Almost every distinction below can be demonstrated on those four columns, so keep them in mind as the definitions arrive.

Key idea: Statistics turns raw measurements into claims that can be defended, and the first move is naming exactly what kind of measurement you are holding.

In plain terms

A population is the group the question concerns, and a sample is the observed subset. A parameter describes the population; a statistic is computed from data. A parameter can be known, for example from a complete and accurate census, although inference usually addresses unknown parameters. Variable type helps determine useful operations. Study design, dependence, the scientific question, and model assumptions also matter when choosing an analysis. [1]

Population, sample, parameter, statistic

A population is the entire group or process about which we want to make a statement. A sample is the set of units observed from it. A parameter is a numerical feature of the population or model; a statistic is calculated from the sample. Neither definition says that the number must be unknowable or perfectly measured.

For example, the true average height of all adults is a parameter; the average height of 200 adults we measured is a statistic. A memory hook: parameter goes with population, and statistic goes with sample. Nearly every inference problem in this course is really the same shape: we see a statistic and want to say something trustworthy about the parameter we cannot see.

Worked example. Suppose five fictional patients report annual incomes of 30,000, 42,000, 38,000, 51,000, and 39,000 dollars. Their total is 200,000 and their sample mean is 40,000 dollars. This arithmetic is exact for the recorded values, but recording errors and selection bias could still matter. The mean income of all 4,000 registered patients is the target parameter. It could be measured by an accurate complete census; these five records alone do not determine it.

A census attempts to measure every unit in a defined population at a defined time. It removes sampling variation for that finite population if complete and accurate, but coverage, measurement, and processing errors can remain. Sampling may be cheaper or necessary for destructive testing. A larger count of observations is not a substitute for defining the population and measuring the intended variable.

Key idea: Parameter and statistic describe the role of a number, not whether someone knows it. Inference uses observed statistics to learn about a specified population or process.

Categorical versus quantitative variables

A variable is any characteristic that can differ from one individual to the next; the individuals (or cases) are the people or objects being measured. A categorical (qualitative) variable places each individual into a group, such as eye color, country, or whether a patient improved. A quantitative variable is a number you can meaningfully do arithmetic with, such as height, income, or reaction time. [3]

Quantitative variables can be discrete, taking a finite or countably infinite set of values, or continuous, modeled over a continuum. Counts of visits are discrete. Temperature is often modeled continuously even though an instrument records finite precision. Arithmetic is useful when it respects the measurement: averaging sibling counts describes an average count, while averaging ZIP codes does not describe a geographical amount.

Run that test on the clinic's four columns. Averaging blood types is meaningless, because A and O are names rather than amounts. Averaging incomes is clearly fine, and so is averaging temperatures. Averaging pain ratings is the interesting case, and the next section explains why it sits in a gray zone. Notice too that a variable's type belongs to the measurement rather than to the thing measured. Age recorded in years is quantitative, while the same age recorded as "child, adult, senior" is categorical. The recording decision, not the person, fixes the type.

Key idea: Ask whether averaging the values would mean anything. If it would not, the variable is categorical however numeric it looks.

Four examples distinguish nominal categories, ordinal responses, interval temperature, and ratio length. Numeric codes alone do not establish a quantitative scale.
Four examples distinguish nominal categories, ordinal responses, interval temperature, and ratio length. Numeric codes alone do not establish a quantitative scale.

The four levels of measurement

Beyond the categorical-quantitative split, statisticians recognize four levels of measurement, a useful framework for describing which comparisons a measurement supports: [2]

  • Nominal: named categories with no order (blood type, favorite color, jersey number used only as a label). You can count how many fall in each group, but ordering them is arbitrary.
  • Ordinal: ordered categories, but the gaps between them are not equal or not meaningful (small, medium, large; survey ratings from "strongly disagree" to "strongly agree"; race finishing places). You know first beat second, but not by how much.
  • Interval: ordered numbers with equal gaps but no true zero (temperature in Celsius or Fahrenheit; calendar years). A ten-degree jump means the same amount anywhere on the scale, but zero degrees does not mean "no temperature," so ratios fail.
  • Ratio: ordered numbers with equal gaps and a true zero, so ratios make sense (height, weight, income, time elapsed). Because zero means "none," 40 kg really is twice 20 kg.

The levels help explain why a calculation is meaningful. Ordered categories support rank comparisons, whereas numerical differences require a defensible scale. Greater precision can retain useful information, but collection should also respect privacy, respondent burden, and the purpose of the study. Do not collect sensitive detail simply because storage is available. [2]

Key idea: Measurement determines which comparisons are meaningful. The scientific question, study design, and statistical model also determine what can be learned. No measurement label selects a complete analysis by itself.

Worked example: sorting a survey

Worked classification. Blood type is categorical and nominal. A pain response coded 1 through 10 is ordered, but equal differences in its codes need not mean equal differences in experienced pain. Celsius temperature is commonly modeled as continuous and interval. Income recorded to the nearest cent has discrete recorded values, though a continuous model can be a useful approximation. Income with a meaningful zero supports ratios; the exact definition of income and treatment of negative amounts must be specified.

Worked example: what the level lets you compute

For ten ordered pain responses 2, 3, 3, 4, 4, 5, 6, 7, 8, 10, the two central categories are 4 and 5. Reporting those categories or the cumulative distribution uses their order alone. The arithmetic midpoint 4.5 and mean 5.2 can be calculated from the codes, but both use numerical spacing beyond mere ordering. If an analyst treats this scale as approximately interval, that modeling choice must be stated. Calling 4.5 an ordinal median does not remove the extra assumption.

Now contrast the other two numeric columns. If two patients report 40,000 and 80,000 dollars, the second earns exactly twice the first, and that claim is meaningful because zero dollars really does mean no income. Try the same move on temperature. A reading of 40 degrees Celsius is not twice as hot as 20 degrees, because 0 Celsius is the freezing point of water rather than the absence of heat. Differences still behave: 40 minus 20 is a genuine 20-degree gap. Only the ratio fails, and it fails for exactly one reason, the missing true zero.

Key idea: Interval data supports differences and means; ratio data supports those plus ratios. A missing true zero is the whole difference.

The fifth and sixth ordered responses are categories 4 and 5. Calculating a numerical midpoint of 4.5 uses more than their ordering.
The fifth and sixth ordered responses are categories 4 and 5. Calculating a numerical midpoint of 4.5 uses more than their ordering.

How measurement and design guide analysis

Variable type narrows the choices. A nominal variable can be summarized with counts and a bar chart; a quantitative variable can use a histogram. The design and question then matter: repeated observations from the same person are not independent merely because their values are quantitative. A useful analysis begins with the unit of observation, target population, and intended comparison. [4]

A histogram can display a quantitative distribution; a bar chart can display category counts. Pearson correlation summarizes linear association between two quantitative variables with positive variance. A contingency-table chi-square test addresses categorical counts under specific sampling conditions. These are starting choices, not rules that determine an entire analysis automatically.

Key idea: Naming the variable type is the first move in any analysis, because it narrows the legal tools down to a short list.

Common misconceptions

  • Numerals versus numbers. ZIP codes, phone numbers, and jersey numbers are labels that happen to be written with digits. Software will average them without complaint, and the answer will be meaningless. The test is never what the values look like, only whether arithmetic on them means anything.
  • Population versus sample. The population is whoever you want to describe, which is a decision you make rather than a fact about the data. The 200 clinic surveys are a sample when the question concerns all 4,000 patients, and a population when the question concerns only those 200 respondents.
  • Parameter versus statistic. In a frequentist model a parameter is fixed, possibly unknown, while a statistic varies across hypothetical samples. Collapsing the two makes the logic of inference vanish, because inference exists precisely because they differ.
  • Interval versus ratio. The only question that matters is whether zero means "none." Zero dollars means no income, so income is ratio. Zero degrees Celsius is just a temperature, so Celsius is interval, and the year 2000 is not twice the year 1000.

Recap

  • Descriptive statistics summarizes the data in hand; inferential statistics uses a sample to make claims about a larger group, always with stated uncertainty.
  • A population is the whole group of interest and a sample is the part you measure; a parameter describes the population and a statistic describes the sample.
  • Categorical variables sort individuals into groups, while quantitative variables measure amounts and split into discrete counts and continuous measurements.
  • The four levels of measurement are nominal, ordinal, interval, and ratio, and each licenses more arithmetic than the one before it.
  • Variable type, design, and the question jointly guide an appropriate graph, summary, and analysis.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What distinguishes a parameter from a statistic? Can either be known?
  2. Which arithmetic does an ordinal scale alone justify?
Check your reasoning
  1. A parameter describes a population or model; a statistic is computed from a sample. A complete accurate census can reveal a finite-population parameter.
  2. Ordering and central categories are meaningful; an arithmetic midpoint or mean adds a spacing assumption.

Remember: Numeric-looking codes do not necessarily measure amounts. An arithmetic midpoint of ordinal codes also requires a spacing assumption.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. OpenStax (2023), Introductory Statistics 2e, 1.1: Definitions of Statistics, Probability, and Key Terms. Read the source.
  2. OpenStax (2023), Introductory Statistics 2e, 1.3: Frequency Tables and Levels of Measurement. Read the source.
  3. OpenStax (2023), Introductory Statistics 2e, 1.2: Data, Sampling, and Variation. Read the source.
  4. Penn State STAT 500, Lesson 1: Collecting and Summarizing Data. Read the source.
Key terms
Population
The entire group of individuals we want to study.
Sample
The subset of the population we actually observe or measure.
Parameter
A numerical feature of a specified population or model; it may be known or unknown.
Statistic
A numeric summary computed from a sample.
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.
Descriptive statistics
Methods that summarize a dataset without generalizing beyond it.
Inferential statistics
Methods that use a sample to draw conclusions about a population, with stated uncertainty.

Displaying Data: Histograms and Distribution Shape

  • Build a frequency and relative-frequency table from raw data.
  • Read a histogram and describe a distribution's shape, center, and spread.
  • Tell a histogram apart from a bar chart and know when each is used.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

Once you know a variable's type, the next step is to picture its distribution, which is the pattern of values it takes and how often each occurs. A good graph reveals in one glance what a column of numbers hides: where the data piles up, how far it spreads, and whether anything looks out of place. For a single quantitative variable, the workhorse graph is the histogram.

The fictional Riverside Commute Study contains these 40 integer-minute trips: 4,6,7,8,9, 10,11,12,14,15,16,18,19, 20,20,21,22,23,24,25,26,27,28,28,29, 30,31,32,33,34,35,36,37,38,39, 40,42,44,46,47. Retaining the raw values makes alternative bin choices reproducible. The minimum is 4 and maximum 47.

Key idea: A distribution is the pattern of values a variable takes together with how often each value occurs, and a graph is how you see that pattern rather than merely storing it.

In plain terms

Start by grouping quantitative observations into nonoverlapping intervals, then count the observations in each. With equal-width bins, count heights make a useful display. With unequal widths, use density so area represents proportion. Adjacent intervals meet on a numerical scale; an empty bin has zero height. Read the shape, center, spread, and unusual observations together. Changing the width or placement of bins can change the appearance, so compare sensible choices. Category counts usually call for a bar chart with separated bars; preserve the order of ordered categories.

Frequency and relative-frequency tables

To build a histogram you first group the data into equal-width intervals called bins (or classes) and count how many values fall in each. The count is the frequency; dividing by the total gives the relative frequency, a proportion between 0 and 1 that you can also read as a percent. Consider 40 values grouped into five bins: [1]

BinFrequencyRelative frequency
0-950.125
10-1980.200
20-29120.300
30-39100.250
40-4950.125

The exact relative frequencies sum to one because the bins form a partition of the 40 observations. Rounded displayed proportions may differ slightly from one. Here the counts sum to 40 and the displayed proportions sum to 1.000. A bin containing 12 of 40 and one containing 300 of 1,000 both represent 30%, which allows a proportion comparison even though their raw counts differ.

Worked example: building the table. The bins above are the Riverside commute times in minutes, and every relative frequency comes from the same division by the total of 40. The first bin holds 5 commuters, so its relative frequency is 5 / 40 = 0.125, which is 12.5 percent. The second holds 8, giving 8 / 40 = 0.200. The busiest bin holds 12, giving 12 / 40 = 0.300. The fourth holds 10, giving 10 / 40 = 0.250, and the last holds 5 again for another 0.125. Adding those five proportions gives 0.125 + 0.200 + 0.300 + 0.250 + 0.125 = 1.000 exactly, and adding the five counts gives 5 + 8 + 12 + 10 + 5 = 40, which is the number of commuters you started with. Run both checks every time, because a total that misses by one is almost always a value filed into the wrong bin.

A cumulative relative frequency adds the proportions in increasing order: 0.125, 0.325, 0.625, 0.875, 1.000. Here 62.5% of recorded times are below 30 minutes and 37.5% are at least 30. With continuous measurements, use explicit boundaries such as 20 <= x < 30; labels such as 20-29 apply here because the recorded values are integers. [3]

Key idea: Frequencies count, relative frequencies express those counts as proportions of the whole, and the proportions must sum to 1, which gives you a free arithmetic check on your own bookkeeping.

From table to histogram

A histogram groups quantitative observations into nonoverlapping intervals. Adjacent intervals meet along a numerical axis. For equal-width intervals, count or relative-frequency heights are useful. With unequal widths, use density = count / (sample size x bin width) so bar area, rather than height alone, represents a proportion. An empty interval is allowed to have a zero-height bar. [1] [2]

Bins [0,10), [10,30), and [30,50) have proportions 0.125, 0.500, and 0.375. Density heights are proportion divided by width; the total area is one.
Bins [0,10), [10,30), and [30,50) have proportions 0.125, 0.500, and 0.375. Density heights are proportion divided by width; the total area is one.

The choice of bin width

Bin width and the placement of boundaries can change the displayed shape. Wide bins can hide features; narrow bins can emphasize sampling variation. Compare sensible choices and, for small samples, inspect the individual values. A feature that changes under rebinning is sensitive to the plotting choice. That observation alone does not establish whether it is a real population feature or random noise. [4]

Worked example: rebinning with evidence. In the listed raw values, six observations in the 20-29 group are below 25 and six are at least 25. Therefore bins 0 <= x < 25 and 25 <= x < 50 contain 19 and 21 trips. The original grouped table alone would not justify splitting its 12 middle observations evenly. The ten width-five counts, calculated from the raw values, are 1,4,4,4,6,6,5,5,2,3. Each display is a summary with a different resolution, not a revelation of a uniquely correct shape.

Key idea: Bin width is an analyst's choice rather than a property of the data, so a responsible histogram is one whose shape survives a change in that choice.

The supplied 40 integer commute times give counts 5,8,12,10,5 at width ten and 1,4,4,4,6,6,5,5,2,3 at width five. Rebinning requires the raw data.
The supplied 40 integer commute times give counts 5,8,12,10,5 at width ten and 1,4,4,4,6,6,5,5,2,3 at width five. Rebinning requires the raw data.

Describing shape, center, and spread

When you describe a distribution, always mention three things: shape, center, and spread, plus any unusual points. Common shapes are symmetric (the left and right halves mirror each other, like the mound above), right-skewed (a long tail stretching toward high values, common for income, house prices, or wait times), and left-skewed (a long tail toward low values, as with exam scores on an easy test).

An approximately uniform display has roughly constant density across its range. A bimodal display has two visible peaks. Mixing different groups can produce several peaks, but a histogram alone does not identify those groups, and mixtures need not be bimodal. An outlier is an observation unusual relative to the pattern or model being considered. It merits investigation because it may reflect an error, a different process, or useful variation.

Worked example: describing the Riverside histogram in sentences. A complete description names all three features and then mentions anything unusual. Shape comes first: the bars rise from 5 to 8 to 12 and then fall back through 10 to 5, which is a single mound that is close to symmetric, with only a slight lean toward the higher values. Center comes second: the tallest bin covers 20 to 29 minutes, and the cumulative column showed that half the commuters sit below roughly the mid-twenties, so a typical trip is about twenty-five minutes. Spread comes third: the values run from under ten minutes to nearly fifty, so the full range is about forty minutes wide, and the middle bins hold most of the crowd. Finally, nothing sits detached from the rest, so this dataset reports no obvious outliers. Those four sentences say more about the commute than the forty raw numbers ever could.

Skew is named for the direction of the tail, not the location of the tallest bar. Some distributions of income or waiting time have long right tails, but the shape of a particular dataset must be examined rather than inferred from its subject. Mixing subgroups can create several peaks, although overlapping subgroups may still produce one peak.

Key idea: Describe every distribution with shape, center, and spread, then note outliers, and remember that skew is named for the direction of the tail rather than the direction of the pile.

Histogram versus bar chart

A histogram is for a quantitative variable, and its bars touch because the axis is a number line whose order cannot be changed. A bar chart is for a categorical variable: its bars have deliberate gaps, and the categories can be reordered when their categories are nominal; preserve the meaningful order of ordinal categories (alphabetically, by size, however you like) without changing the meaning. Confusing the two is one of the most common early mistakes, and it is not merely cosmetic. Touching bars imply a continuous scale; if you draw pizza toppings with touching bars, you are falsely suggesting "pepperoni" and "mushroom" are adjacent points on a number line. Always check the variable type first, then pick the display.

Key idea: Touching bars claim a continuous number line underneath them, so a histogram is only honest when the variable really is quantitative.

Common misconceptions

  • Reading an axis without its scale. The horizontal position identifies the measured interval. A count height answers how many observations occupy an equal-width bin. In a density histogram, area gives the proportion; height alone does not give a count when widths differ. Read both axis labels before interpreting a tall bar.
  • Naming skew backwards. Students see the tall bars on the left and call the distribution left-skewed. The label follows the tail, so bulk on the left with a long tail to the right is right-skewed, and the classic examples are income and waiting times.
  • Trusting a single bin width. A feature that changes with binning is sensitive to the display choice. That observation alone cannot establish whether the feature reflects sampling variation or a population pattern. Compare sensible displays and inspect the underlying values when available.
  • Mixing up histograms and bar charts. Bar charts show categories, so their bars are separated and can be reordered when their categories are nominal; preserve the meaningful order of ordinal categories. Histogram bins live on a number line, so their bars touch and their order is fixed by arithmetic rather than by preference.
  • Treating an outlier as a mistake. A detached value deserves investigation rather than automatic deletion, since it may be a typing error, a genuinely unusual case, or the most informative observation in the entire dataset.

Recap

  • A frequency table groups quantitative data into equal-width bins and counts them, while relative frequencies convert those counts to proportions that must sum to 1.
  • A histogram draws one bar per bin with touching bars, because the horizontal axis is a continuous number line rather than a list of labels.
  • Bin width is a judgment call: too wide hides structure, narrow bins can emphasize small fluctuations, and roughly five to twenty bins is a sensible starting range.
  • Describe any distribution by shape, center, and spread, then note outliers, and name skew after the direction of the long tail.
  • Histograms serve quantitative variables and bar charts serve categorical ones, so the variable type decides the display before any drawing begins.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What does area represent in a normalized unequal-bin histogram?
  2. Does a bump disappearing after rebinning prove it was noise?
Check your reasoning
  1. The proportion in the bin; height is proportion divided by width.
  2. No. It establishes sensitivity to bin choices, not the origin of the feature.

Remember: A histogram can have unequal widths when its vertical scale is defined appropriately. Bar order is meaningful for ordered categories.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 1.3.3.14: Histogram. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Histogram. Read the source.
  3. OpenStax (2023), Introductory Statistics 2e, 1.3: Frequency Tables and Levels of Measurement. Read the source.
  4. Orloff and Bloom, MIT 18.05 (Spring 2022), Reading 6b: Central Limit Theorem and Law of Large Numbers. Read the source.
Key terms
Distribution
The pattern of values a variable takes and how frequently each occurs.
Histogram
A display grouping quantitative values in intervals; density heights make bar areas proportional to frequency.
Frequency
The count of data values falling in a bin or category.
Relative frequency
A frequency divided by the total, giving a proportion.
Skewed
A distribution with one tail longer than the other.
Outlier
A data value that lies far from the bulk of the data.
Bimodal
A distribution with two distinct peaks, often signaling two mixed subgroups.
Bin (class)
An interval used to group quantitative observations in a histogram.

Boxplots and the Five-Number Summary

  • Find the five-number summary of a dataset.
  • Compute the interquartile range and use the 1.5 x IQR rule to flag outliers.
  • Sketch and interpret a boxplot, and use it to compare groups.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

Strip a distribution down to its skeleton, and five numbers are what is left. That skeleton is called a boxplot (box-and-whisker plot): a compact picture of a distribution built from those five key positions. Where a histogram shows the full shape of one variable, a boxplot keeps only the frame, which makes it especially good for two jobs: comparing several groups side by side and spotting outliers at a glance.

A single concrete dataset anchors the entire lesson. The Northside Clinic wait-time log records, for seven consecutive weekday afternoons, how many minutes elapsed between a patient's scheduled appointment and the moment the physician actually appeared. Sorted from smallest to largest, those seven observations are 3, 5, 7, 8, 12, 13, and 15 minutes. Every quantity introduced below is computed from exactly those numbers, so the arithmetic remains verifiable by hand throughout, and the resulting summary is compact enough to compare against another clinic's log later.

Key idea: A boxplot compresses an entire distribution into five carefully chosen positional summaries, which sacrifices detail in exchange for immediate comparability across groups.

In plain terms

A boxplot compresses a quantitative distribution into selected positions. The median describes the middle, and quartiles describe positions near one quarter and three quarters through the ordered data. The box spans Q1 to Q3. Whiskers and separately marked values show the tails under a stated plotting convention. Ties, small samples, and interpolation mean the visible pieces need not contain exactly equal numbers of observations. A boxplot should therefore be read as a compact summary, not as a complete reconstruction of the data.

The five-number summary

The five-number summary is the minimum, Q1, median, Q3, and maximum. This lesson computes Q1 and Q3 as medians of the lower and upper halves, excluding the central position when n is odd. Do not remove every observation equal to the median. Quartile definitions vary across software, so record the convention before comparing answers. [1]

Quartiles correspond to the 25th, 50th, and 75th percentile positions, but sample quantile algorithms differ in interpolation and endpoint handling. R documents nine quantile types, and its boxplot hinges can differ from its default quantiles. In this lesson, hand computations use the stated median-of-halves rule. Later R output uses R defaults unless the code explicitly selects another rule. [2]

Key idea: Quartiles are positional summaries that report the proportion of observations lying below a value, which makes them insensitive to how extreme the extreme observations happen to be.

Worked example

Find the five-number summary of these 7 sorted values: 3, 5, 7, 8, 12, 13, 15.

  • Minimum = 3, Maximum = 15.
  • Median (Q2) = the 4th value = 8 (with 7 values, the middle one is position 4).
  • Lower half (the three positions before the central position) is 3, 5, 7, so Q1 = 5.
  • Upper half (the three positions after the central position) is 12, 13, 15, so Q3 = 13.

The interquartile range is IQR = Q3 - Q1 = 13 - 5 = 8. The IQR measures the spread of the middle 50% of the data, and because it ignores the extreme quarter on each end, it is resistant to outliers, unlike the full range. That resistance is exactly why the IQR pairs naturally with the median, another resistant measure, when a distribution is skewed.

Worked example: what resistance actually buys you. Suppose an eighth afternoon is recorded during which an emergency delayed the physician for 60 minutes, producing the sorted list 3, 5, 7, 8, 12, 13, 15, 60. The overall range immediately explodes from 15 - 3 = 12 minutes to 60 - 3 = 57 minutes, an almost fivefold increase produced by a single observation. Now recompute the quartiles under the same convention. With eight observations, the lower half consists of 3, 5, 7, and 8, whose median is (5 + 7) / 2 = 6, while the upper half consists of 12, 13, 15, and 60, whose median is (13 + 15) / 2 = 14. The interquartile range therefore becomes 14 - 6 = 8 minutes, which is identical to the original value. One catastrophic afternoon multiplied the range by nearly five and left the interquartile range completely unchanged, which is the entire practical argument for preferring resistant summaries whenever a distribution has a long tail.

Key idea: The range depends entirely on the two most extreme observations, whereas the interquartile range depends only on the central half, so the two respond very differently to a single unusual value.

The 1.5 x IQR rule for outliers

A value is flagged as a potential outlier if it falls below the lower fence Q1 - 1.5 x IQR or above the upper fence Q3 + 1.5 x IQR. Here the fences are 5 - 1.5(8) = 5 - 12 = -7 and 13 + 1.5(8) = 13 + 12 = 25. Since every value lies between -7 and 25, there are no outliers in this dataset. The 1.5 multiplier is a convention, not a law of nature: it is calibrated so that, for roughly bell-shaped data, only a tiny fraction of genuine values get flagged, so a flag is worth a second look rather than an automatic deletion. [1]

Worked example: applying the fences to the eight-day log. Return to the extended dataset that includes the 60-minute afternoon, for which Q1 = 6, Q3 = 14, and IQR = 8. The lower fence is 6 - 1.5(8) = 6 - 12 = -6 minutes, and the upper fence is 14 + 1.5(8) = 14 + 12 = 26 minutes. Every observation from 3 through 15 lies comfortably inside that interval, but 60 exceeds the upper fence of 26 by a wide margin and is therefore flagged. Notice what the flag does and does not establish. It establishes that the observation is unusual relative to the central half of this particular distribution, and it establishes nothing whatever about whether the observation is erroneous. A clinic administrator reading this result should investigate the afternoon in question, because the correct response depends entirely on what caused the delay, and discarding a legitimate emergency would systematically understate how long patients actually wait.

Key idea: The 1.5 multiplier is a widely adopted convention rather than a mathematical necessity, and a flagged observation is an invitation to investigate rather than an instruction to delete.

Using median-of-halves quartiles, adding 60 changes the median to 10, Q1 to 6 and Q3 to 14. The upper fence is 26, the upper whisker ends at 15, and 60 is a separate point.
Using median-of-halves quartiles, adding 60 changes the median to 10, Q1 to 6 and Q3 to 14. The upper fence is 26, the upper whisker ends at 15, and 60 is a separate point.

Drawing and reading a boxplot

To draw the boxplot, mark Q1, the median, and Q3 to form the box, then draw whiskers out to the smallest and largest values that are not outliers. Any outliers are plotted as separate dots beyond the whiskers. A boxplot instantly shows center (the median line), spread (the box width for the middle half, and the whisker length for the rest), and skew: a longer whisker on one side, or a median pushed toward one end of the box, signals a tail in that direction. [4]

Note what a boxplot hides, though. Because it reports only five numbers, it cannot show whether a distribution is bimodal; two very different shapes can produce identical boxplots, so for a single variable a histogram is often more revealing.

Comparing groups side by side

The real payoff of boxplots comes when you line several up on the same axis, one per group. Suppose you plot test scores for three class sections. In one glance you can compare their medians (which section is typically higher), their spreads (which section is more consistent, shown by a narrower box), and their outliers (which section has an unusually low or high student). This side-by-side comparison, clean and free of clutter, is a task histograms do poorly and boxplots do beautifully, which is why boxplots are a staple of exploratory data analysis.

Worked example: comparing two fictional clinics. Northside has median 8 and IQR 8 minutes; Southside has median 11 and IQR 4. The recorded Southside middle values are less spread out and its recorded median is larger. These summaries do not give the expected mean wait, show the complete tails, or justify a population recommendation from seven afternoons. Compare sampling times, case mix, and more observations before making an operational decision.

Key idea: Comparing medians answers which group is typically higher, while comparing box widths answers which group is more consistent, and those two questions have genuinely independent answers.

Common misconceptions

  • Counting observations from a boxplot. Quartiles mark approximate quarter positions. Repeated values, interpolation, and separately plotted outliers prevent an exact 25%-per-visible-segment reading. A long segment indicates a broad range of values; it does not by itself specify a count.
  • Treating an outlier flag as a verdict. The fences implement an arbitrary convention calibrated so that genuinely bell-shaped data produces few flags. Deleting flagged observations without investigation biases the resulting summaries and is a documented source of misleading applied analyses.
  • Expecting a boxplot to reveal a bimodal distribution. Because only five positional numbers are plotted, two profoundly different distributions can generate visually identical boxplots. When the underlying shape matters, a histogram or dotplot must accompany the boxplot.
  • Confusing the interquartile range with the range. The range subtracts the minimum from the maximum and is destroyed by any single extreme observation, whereas the interquartile range subtracts Q1 from Q3 and ignores the extreme quarter at each end entirely.

Recap

  • The five-number summary consists of the minimum, first quartile, median, third quartile, and maximum, and those quartiles mark approximate quarter positions under a specified convention.
  • The interquartile range, computed as Q3 minus Q1, measures the spread of the central half and is resistant to extreme observations in a way the range is not.
  • The conventional fences at Q1 minus 1.5 times the IQR and Q3 plus 1.5 times the IQR flag potential outliers for investigation rather than for deletion.
  • Whiskers extend to the most extreme observations that are not flagged, and flagged observations are plotted individually beyond the whiskers.
  • Boxplots aligned on a common axis compare centers, spreads, and outliers across groups efficiently, but they cannot reveal bimodality or exact frequencies.

Quartile convention check

For 3,5,7,8,12,13,15, the hand rule gives Q1=5 and Q3=13. R default quantile(x), type 7, gives Q1=6 and Q3=12.5. Its boxplot hinges also give 6 and 12.5 for this example. Both computations follow defined rules. A solution is incomplete if it reports conflicting answers without identifying their conventions. In the original charts for this lesson, the manual quartiles are supplied explicitly to the plotting routine. [3]

For 3,5,7,8,12,13,15, median-of-halves gives Q1=5 and Q3=13; R type 7 gives 6 and 12.5. The common median is 8. The convention must accompany the result.
For 3,5,7,8,12,13,15, median-of-halves gives Q1=5 and Q3=13; R type 7 gives 6 and 12.5. The common median is 8. The convention must accompany the result.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. How does a fence differ from a whisker endpoint?
  2. Why can software quartiles disagree with the hand method?
Check your reasoning
  1. A fence is a calculated threshold; a whisker ends at an observed in-fence value under the stated convention.
  2. Sample quantile and hinge algorithms differ. Identify the rule instead of labeling every difference an error.

Remember: A flagged value is not automatically erroneous. A boxplot cannot determine an expected mean wait from its median alone.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 1.3.3.7: Box Plot. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Sample Quantiles. Read the source.
  3. R Core Team, R-devel 4.6.0 documentation: Box Plot Statistics. Read the source.
  4. OpenStax (2023), Introductory Statistics 2e, 2.4: Box Plots. Read the source.
Key terms
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% of the data.
Boxplot
A graph showing the five-number summary as a box with whiskers.
Whisker
A line from the box to the most extreme non-outlier value.
1.5 x IQR rule
A value is a potential outlier if it is more than 1.5 IQR beyond Q1 or Q3.
Fence
The cutoff Q1 minus 1.5 IQR or Q3 plus 1.5 IQR used to flag outliers.
Resistant measure
A summary such as the median or IQR that is barely affected by extreme values.

Study Design, Sampling Bias, and Causal Questions

  • Distinguish random selection from random assignment and state what each supports.
  • Identify confounding, dependence, and avoidable measurement or selection errors.
  • Write a reproducible design with a defined population, outcome, comparison, and analysis plan.

Good analysis begins before the first number is recorded. A precise calculation can answer the wrong question if the sample, outcome, or comparison is poorly defined. This lesson asks what a study can support, which uncertainty its formulas capture, and what must be recorded so someone else can assess the conclusion.

Define the question and observational unit

Start with a concrete population, time period, and outcome. "Does tutoring work?" leaves all three unclear. A more useful question is whether assigning a particular tutoring offer changes a specified assessment score, measured at a specified time, for the students eligible for the study. The outcome, treatment comparison, and target population are parts of the question, not details to choose after examining results.

An observational unit is the entity represented by an observation, such as a person or school. An experimental unit is the entity independently assigned a treatment. If entire classrooms are assigned, individual pupils are not independently randomized units. Measuring 500 pupils in four classrooms does not create 500 independent treatment assignments. Record identifiers that preserve the design without exposing unnecessary personal information.

Random selection and random assignment

Random selection chooses units from a population through a probability mechanism. Under an appropriate sampling and response process, it supports generalization to that population. Random assignment allocates enrolled experimental units to treatment conditions. It supports causal comparisons by making assignment independent of pretreatment characteristics through the randomization mechanism. These are different operations. [3]

A trial using volunteers can have randomized assignment but limited population representativeness. A random population survey can be broadly representative yet remain observational if people chose their exposures. A study can use both operations, one, or neither. Describe each explicitly instead of using the word random without identifying what was randomized.

Randomization balances characteristics in expectation over assignments; it does not guarantee exactly equal groups in one trial. Likewise, a probability sample can happen to differ from its population. Confidence intervals address random variation under a model or design, not every possible source of error. [1]

Probability selection concerns which population units enter a sample. Random assignment allocates enrolled units to conditions. Neither operation guarantees that all other study problems are absent.
Probability selection concerns which population units enter a sample. Random assignment allocates enrolled units to conditions. Neither operation guarantees that all other study problems are absent.

Confounding and selection

Suppose students who voluntarily attend tutoring later obtain higher scores. Prior knowledge and motivation might influence attendance and performance. A confounder can affect both exposure and outcome, creating or distorting the observed association. The comparison does not isolate what would happen if otherwise comparable students were assigned tutoring.

Simply including a measured variable in regression does not guarantee that confounding is removed. Important factors may be unmeasured or badly measured, and some variables should not be adjusted for. A causal analysis requires an explicit design and assumptions about how variables relate. In this introductory course, distinguish an adjusted association from an identified causal effect rather than claiming adjustment solves every problem. [4]

Selection bias arises when inclusion or retention produces a comparison inappropriate for the target question. Measurement error arises when recorded values differ from the intended quantities. They can coexist. An accurate instrument used only on an unrepresentative set of participants does not fix selection, and a random sample measured with a systematically biased instrument does not fix measurement.

In a hypothetical causal structure, motivation affects both tutoring attendance and later score. The attendance-score association alone does not isolate the effect of assigning tutoring.
In a hypothetical causal structure, motivation affects both tutoring attendance and later score. The attendance-score association alone does not isolate the effect of assigning tutoring.

Plan an interpretable experiment

In a fictional design, 40 eligible volunteers are assigned at random, 20 to an offer of a tutoring session and 20 to a specified comparison condition. Both groups take the same assessment after the same interval. The primary outcome and analysis are written down before results are viewed. Assignment could be generated in R with set.seed(20261105); assignment <- sample(rep(c("offer","comparison"),each=20)). Retain the ordered participant identifiers and assignment file. [2]

The random seed makes a particular pseudo-random computation reproducible. It is not a substitute for concealing allocation when needed, obtaining valid participation arrangements, or preventing selective changes after assignments are known. Where possible, keep outcome assessors unaware of assignments to reduce differential measurement. Participants may know whether they received tutoring, so do not claim blinding that the setting cannot support.

Replication means including independently assigned units, not merely taking repeated readings of the same unit. Blocking assigns treatments within groups defined by a relevant pretreatment characteristic, such as prior attainment. It can improve precision when the block variable predicts the outcome. The analysis must account for the block structure. [1]

Worked example: what the observed difference means

Suppose 12 of the 20 students offered tutoring and 8 of the 20 in the comparison condition reach a prespecified score threshold. The observed proportions are 0.60 and 0.40; their difference is 0.20, or 20 percentage points. The relative increase is (0.60-0.40)/0.40=0.50, or 50%. Those are different descriptions of the same comparison.

The difference is an estimate, not a certainty. A suitable analysis should quantify randomization or sampling uncertainty and report missing outcomes. Comparing everyone according to their assigned offer answers an effect-of-assignment question. Comparing only those who actually attended may reintroduce self-selection. Write which effect is being estimated before interpreting the numbers.

Even a well-executed volunteer experiment does not automatically establish the same effect for all students, different curricula, or later years. Generalization involves how the study population and setting relate to the target. The trial's estimate, precision, and relevance are separate judgments.

Sampling weights and missingness

A stratified sample can deliberately oversample a smaller group. Suppose a fictional population contains 400 commuters in stratum A and 600 in B. Sample means are 10 and 20 minutes, respectively. The population-share-weighted estimate is 0.4(10)+0.6(20)=16 minutes. If 50 people were sampled from each stratum, the unweighted mean would be 15, which answers a different weighting question.

This computation assumes the within-stratum samples and responses adequately represent their strata for the target. Weighting cannot automatically remove all nonresponse or measurement bias. Report the population shares, selection probabilities or weights, number responding, and what happened to incomplete records. A table with a large n may still contain many repeated measurements of a few units or exclude a systematic group.

Write the analysis plan

A useful plan states the primary comparison, unit of analysis, outcome coding, time point, inclusion rules, handling of missing values, estimator, uncertainty procedure, and practical threshold. It also states whether additional comparisons are confirmatory or exploratory. Exploratory plots can reveal valuable patterns; labeling an exploration honestly is better than presenting a discovered pattern as a prediction made in advance.

Before calculating, make a data dictionary with names, units, allowed values, and meanings of missing codes. An entry of 999 used to mean missing must not become a real age in an average. Check ranges, duplicate identifiers, impossible combinations, and whether exclusions were specified independently of the desired conclusion. Keep the original data and a transparent transformation log.

Recap

Evaluate a study by connecting its question to its selection, assignment, measurement, and analysis. No single label, large sample, or small p-value replaces that chain of reasoning. A defensible conclusion identifies the population, effect or association, uncertainty, and remaining limitations.

Common misconceptions

Random assignment does not guarantee exact balance in a realized experiment. A large opt-in sample does not prove representativeness.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. Which operation supports a treatment comparison: selection or assignment?
  2. Does a random seed prove a study was well designed?
Check your reasoning
  1. Random assignment supports a causal comparison under an appropriate implementation; selection addresses the sampled population.
  2. No. It reproduces a pseudo-random computation, not consent, coverage, allocation integrity, or follow-up.

Remember: Random assignment does not guarantee exact balance in a realized experiment. A large opt-in sample does not prove representativeness.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 5.3.3.1: Completely Randomized Designs. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Random Samples and Permutations. Read the source.
  3. Penn State STAT 500, Lesson 1: Collecting and Summarizing Data. Read the source.
  4. Hernan and Robins, Causal Inference: What If, author-hosted August 19, 2026 version. Read the source.
Key terms
Observational unit
The entity represented by an observation.
Experimental unit
The entity independently assigned a treatment.
Random selection
A probability mechanism for selecting population units.
Random assignment
A chance mechanism allocating experimental units to conditions.
Confounding
Distortion of an exposure-outcome comparison through common causes.
Blocking
Randomizing within groups defined by a relevant pretreatment characteristic.
Selection bias
Selection or retention that distorts the intended comparison.
Analysis plan
A prespecified record of outcomes, comparisons, exclusions, and methods.

Module 2: Summarizing Data with Numbers

Measures of center and spread, and the z-score and normal model that let us compare any values on a common scale. You will compute each summary by hand and learn which one to trust for skewed data.

Measures of Center: Mean, Median, and Mode

  • Compute the mean, median, and mode of a dataset.
  • Explain why the median resists outliers while the mean does not.
  • Choose the better measure of center for a skewed distribution.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

A measure of center reports a single typical value that stands in for a whole dataset. It answers the everyday question "what is a normal amount?" The three measures you need are the mean, the median, and the mode, and a surprising amount of statistical judgment comes down to knowing which one to report.

One small dataset threads through the lesson. The Bluebird Coffee order book records how many custom cakes were ordered on each of six consecutive shifts, and those counts were 4, 7, 7, 9, 10, and 3. Six numbers are few enough that every calculation below can be checked mentally, yet enough to demonstrate every distinction that matters, including what happens later when a single enormous wedding order arrives and distorts one summary while leaving another untouched.

Key idea: Center is not a single well-defined quantity but a question with three standard answers, and choosing among them is a substantive judgment rather than a formatting preference.

In plain terms

Three summaries compete for the title of "typical value," and each is answering a different question. Ask the mean: what would everyone get if the total were split equally? Add everything up, divide by how many there are, done. Ask the median: which value sits exactly in the middle once everyone is lined up in order? That one depends on position, not magnitude. Ask the mode: which value shows up most often? It is the only one of the three that still makes sense when your observations are names rather than numbers. Here is the practical consequence, and it is worth remembering for life, not just this course: because the mean folds every single observation into one sum, one extraordinary value can drag it a long way, while the median barely notices. That single fact is why economists, epidemiologists, and property analysts habitually report medians for quantities like income, hospital cost, and house price.

The mean

The mean (arithmetic average) is the sum of all values divided by how many there are. For a sample of n values, the sample mean is written x-bar. In symbols, x-bar = (sum of all x) / n. The mean is the balance point of the data: if you imagined the values as equal weights placed along a ruler, the mean is the spot where the ruler would balance. Every single value tugs on that balance point, which is both the mean's great strength (it uses all the information) and its weakness (one extreme value can drag it far). [1]

Worked example. Find the mean of 4, 7, 7, 9, 10, 3. The sum is 4 + 7 + 7 + 9 + 10 + 3 = 40, and there are n = 6 values, so x-bar = 40 / 6 = 6.67 (rounded to two decimals).

Worked example: verifying the balance point. The claim that the mean balances the data can be checked arithmetically, because the deviations from the mean must sum to exactly zero. Subtract 6.67 from each Bluebird count in turn to obtain 4 - 6.67 = -2.67, 7 - 6.67 = 0.33, 7 - 6.67 = 0.33, 9 - 6.67 = 2.33, 10 - 6.67 = 3.33, and 3 - 6.67 = -3.67. The negative deviations total -2.67 + -3.67 = -6.34 and the positive deviations total 0.33 + 0.33 + 2.33 + 3.33 = 6.32, which agree to within two hundredths, the entire discrepancy coming from rounding 6.67. Working with the unrounded value of 40/6 would produce exactly zero. This property is not a curiosity; it is the reason the next lesson has to square the deviations before averaging them, since their plain average is guaranteed to be zero for every dataset in existence and therefore measures nothing.

Key idea: The mean is the unique point at which the positive and negative deviations exactly cancel, which is what makes it the balance point and also what makes it sensitive to every observation.

The median

The median is the middle value when the data is sorted. Sorting the same data gives 3, 4, 7, 7, 9, 10. With an even count of 6, the median is the average of the two middle values (positions 3 and 4), so (7 + 7) / 2 = 7. If the count is odd, the median is simply the single middle value, at position (n + 1) / 2. Half the data lies at or below the median and half at or above, which makes it the exact center of position rather than of magnitude. [2]

Worked example: odd and even counts. Both cases are worth practising once. Drop the shift that produced 3 cakes, leaving the five sorted values 4, 7, 7, 9, 10. With n = 5 the median occupies position (5 + 1) / 2 = 3, so it is the third value, which is 7. Now restore the sixth shift, giving 3, 4, 7, 7, 9, 10. With n = 6 there is no single middle position, so the median averages positions 3 and 4, giving (7 + 7) / 2 = 7 once more. Notice that the median need not be a value that actually occurs in the dataset: had the two middle values been 7 and 9, the median would have been 8, a quantity nobody ever recorded.

Key idea: For this six-value example, increasing the largest value while keeping the central ordered values unchanged leaves the median unchanged. The magnitudes of those central values still determine the median.

The mode

The mode is the value that occurs most often. In our data, 7 appears twice and every other value once, so the mode is 7. Under this course's convention, all-distinct observations have no unique repeated mode; tied repeated frequency maxima give multiple modes. The mode works for nominal categorical data, and an ordered categorical variable also permits a median category: the modal eye color or the most common blood type is a perfectly good "center" even though a mean or median of colors is meaningless. [3]

Key idea: The mode is the only measure of center defined for nominal data, which is why survey reports of favourite brand, blood type, or transport mode always quote it.

Which one to trust

The median is resistant to changes in extreme magnitudes. Replacing a value while keeping it beyond the central ordered positions leaves the median unchanged. Adding an observation can change which positions are central, so the amount of movement depends on the data. The mean uses all magnitudes directly. For the six-value example, adding 100 gives the seven-value list considered next. [4]

The sorted list becomes 3,4,7,7,9,10,100. Its median stays at 7, while the mean changes from 40/6=6.6667 to 140/7=20, an increase of 13.3333. This illustrates resistance to an added extreme value in this particular dataset. Choosing a summary still depends on the question: a median describes central position, while a mean connects directly to a total. A graph helps explain how observations are distributed around either summary.

Key idea: Resistance is the technical name for insensitivity to extreme observations, and the median has it while the mean does not, which is the single most consequential difference between them.

For 5,8,8,10,14 the mean is 9 and median 8. Adding 46 gives mean 91/6=15.1667 and median 9, not 8.
For 5,8,8,10,14 the mean is 9 and median 8. Adding 46 gives mean 91/6=15.1667 and median 9, not 8.

Shape tells you which is larger

Comparing a mean and median can suggest sensitivity to large or small values, but their ordering does not uniquely determine distribution shape. Equal mean and median do not prove symmetry. Use the data and graph to inspect tails, clusters, and outliers. Which summary is appropriate also depends on the target: a mean is relevant to total resource use per person even when the distribution is skewed, while a median describes the middle-ranked observation. [1]

Worked example: identical center, different shape. Both -2,-1,0,1,2 and -4,-1,0,2,3 have mean 0 and median 0. The first is symmetric, and the second is not. This counterexample is enough to disprove the rule that mean equals median implies symmetry. It is often useful to report both summaries together with a graph and a statement of what decision the summary is intended to support.

Key idea: Mean and median answer different questions. Their comparison can prompt inspection of a graph, but cannot prove a distribution shape.

Both sets have mean and median zero. The second set is asymmetric, so matching centers cannot establish distribution shape.
Both sets have mean and median zero. The second set is asymmetric, so matching centers cannot establish distribution shape.

Common misconceptions

  • Forgetting to sort before finding the median. The raw Bluebird order 4, 7, 7, 9, 10, 3 has 7 and 9 in the middle positions, which would suggest 8. Sorting first gives 3, 4, 7, 7, 9, 10 and the correct median of 7. The median is defined on the ordered list, never on the recorded order.
  • Selecting a summary from a subject label. Inspect the actual distribution and define the question. A skewed cost distribution can make a median useful for describing a central case, while the mean remains relevant to total resource use. Report the estimand and context instead of declaring a mean automatically inappropriate.
  • Assuming the median ignores the extreme values entirely. It uses them to establish the ordering, but not their magnitudes. Replacing the largest Bluebird order of 10 with 10,000 leaves the median at 7 and moves the mean from 6.67 to 1,671.67.
  • Confusing conventions about the mode. When all observed values are distinct, this course describes the data as having no unique repeated mode. Some software instead reports all tied frequency maxima. Neither convention establishes a data error; identify the rule being used.
  • Confusing the mode with the maximum. The mode is the most frequently occurring value, not the largest one. In the Bluebird data the mode is 7 while the maximum is 10.

Recap

  • The mean is the sum of all values divided by the count, it acts as the balance point of the data, and the deviations from it always sum to zero.
  • The median is the middle value of the sorted data, taken as the single central observation when the count is odd and as the average of the two central observations when it is even.
  • The mode is the most frequently occurring value and is applicable to nominal categories; ordered categories also permit a median category.
  • The median resists changes in extreme magnitudes; the mean uses all values. Choose according to the quantity the question asks about, and accompany the summary with a distribution display.
  • Mean-median ordering is a clue to investigate, not a theorem establishing skewness or symmetry.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What question does the mean answer that the median does not?
  2. Does equality of mean and median prove symmetry?
Check your reasoning
  1. The mean divides the total equally across observations; the median describes central position.
  2. No. The values -4,-1,0,2,3 are a counterexample.

Remember: The mode applies to nominal data, while an ordered categorical variable can also have a median category. Mean-median ordering does not prove skewness.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 1.3.5.1: Measures of Location. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Sample Quantiles. Read the source.
  3. OpenStax (2023), Introductory Statistics 2e, 2.5: Measures of the Center. Read the source.
  4. NIST/SEMATECH, e-Handbook, 1.3.5.6: Measures of Scale. Read the source.
Key terms
Mean
The sum of all values divided by the number of values; the average.
Median
The middle value of sorted data, or the average of the two middle values.
Mode
The value that appears most frequently in a dataset.
Resistant measure
A summary, like the median, that is barely affected by outliers.
x-bar
The standard symbol for the mean of a sample.
Skew
Asymmetry that pulls the mean away from the median toward the longer tail.
Balance point
The physical interpretation of the mean as the point where the data would balance.
Trimmed mean
A mean computed after discarding a fixed percentage of the largest and smallest values.

Measures of Spread: Range, Variance, and Standard Deviation

  • Compute the range and interpret it as a crude measure of spread.
  • Calculate a sample variance and standard deviation step by step.
  • Explain what the standard deviation tells you about typical distance from the mean.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

Two datasets can share the same mean yet look completely different because their values are more or less spread out. Consider two work teams that both average 40 hours a week: one where everyone works close to 40, and one where half work 20 and half work 60. The center is identical; the experience of being on those teams is not. Measures of spread quantify that variability, and they matter just as much as center in describing data.

The anchor dataset is the Willow Park tutoring log, which records how many students attended on each of eight consecutive afternoons: 2, 4, 4, 4, 5, 5, 7, and 9. Every quantity computed below comes from those eight numbers, and every intermediate step is small enough to verify by hand, which matters because the standard deviation is the first formula in this course whose result cannot be guessed by inspection.

Key idea: Two distributions with identical centers can behave entirely differently, so a summary that reports center without reporting variability is incomplete and frequently misleading.

In plain terms

How far do the observations typically sit from their own center? That is what variability measures, and the standard deviation is the standard way of expressing it. Computing it involves four mechanical steps that never change. First, find the mean. Second, subtract the mean from each observation to obtain that observation's deviation. Third, square every deviation, which serves two purposes at once: squaring eliminates the cancellation problem that would otherwise force the total to zero, and it penalizes large departures more heavily than small ones. Fourth, average the squared deviations and take the square root, which returns the answer to the units the data was measured in. The quantity you get right before that final square root is called the variance, and it is indispensable mathematically but awkward to describe in words, because its units are the original units squared. Nobody has an intuition for a squared student or a squared dollar, which is why the standard deviation, not the variance, is what shows up in reports. [4]

Range

The range is maximum minus minimum. For example, 20,40,40,40,60 and 20,20,40,60,60 both have mean 40 and range 40, but their interior observations differ. A range alone loses that information.

For the Willow Park log the range is 9 - 2 = 7 students, which is genuinely informative as far as it goes. Its weakness is that it discards the six observations in between entirely, so it cannot distinguish a dataset clustered tightly around 4 with two isolated extremes from a dataset spread evenly across the whole interval. A further and less obvious defect is that the range tends to grow with sample size, because collecting more observations gives more opportunities to encounter an unusually small or unusually large one. That dependence on n makes the range unsuitable for comparing the variability of samples of different sizes.

Key idea: Adding observations to a retained dataset cannot reduce its range, but it may leave the range unchanged. Independently collected samples need not have ranges ordered by their sample sizes. Compare ranges with attention to n, the graph, and more informative spread measures.

Variance and standard deviation

The standard deviation is the measure of spread that statistics is built on. It is a square-based measure of spread, not the arithmetic mean of absolute distances. To find the sample variance (its square), follow four steps: (1) find the mean; (2) subtract the mean from each value to get deviations; (3) square each deviation; (4) average the squared deviations by dividing their sum by n - 1. [1] [1]

The standard deviation is then the square root of the variance, which returns the answer to the original units. Why square the deviations at all? Because the deviations always sum to exactly zero (the positives and negatives cancel at the balance point), so their plain average is useless. Squaring makes every term non-negative and additionally punishes large deviations more than small ones.

Why divide by n minus 1

For independent, identically distributed observations with finite variance and n >= 2, dividing the sum of squared deviations by n-1 gives an unbiased estimator of population variance. This is Bessel's correction. The sample standard deviation, the square root of that estimate, is not generally unbiased. For a descriptive variance of a completely enumerated finite population, divide its squared deviations by its size. State which target you are computing. [2]

We use sigma and sigma^2 for population standard deviation and variance, and s and s^2 for their sample counterparts. These are useful local conventions, not a universal rule that every Greek symbol denotes a population quantity. Both standard deviations are square roots of variances and use the original measurement units.

Key idea: The n-1 correction has a specific unbiasedness result for variance under independent observations from a common distribution with finite variance. It does not remove sampling bias or make every derived estimator unbiased.

Worked example

Find the sample standard deviation of 2, 4, 4, 4, 5, 5, 7, 9.

Step 1, the mean: the sum is 2 + 4 + 4 + 4 + 5 + 5 + 7 + 9 = 40 and n = 8, so x-bar = 40 / 8 = 5.

Steps 2 and 3, deviations and their squares:

x24445579
x - 5-3-1-1-10024
(x - 5)^2911100416

Step 4, sum the squared deviations: 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32. The sample variance is s^2 = 32 / (8 - 1) = 32 / 7 = 4.57. The sample standard deviation is s = square root of 4.57 = 2.14 (to two decimals).

The sample SD is 2.1381 units. It is a square-based measure of spread, not the arithmetic average of absolute distances from 5. If the eight observations constitute the entire finite population being described, the denominator-8 variance is 4 and its square root is 2. For a fixed dataset of size n, the denominator-n and denominator-(n-1) variances differ by the factor n/(n-1); this factor approaches one as n increases.

Key idea: The Willow Park attendance typically departs from its mean of 5 by about 2.14 students, and that single number now describes the whole dataset's variability in the original units.

For 2,4,4,4,5,5,7,9, squared deviations sum to 32. Sample variance is 32/7 and SD is its square root, 2.1381. This is not mean absolute deviation.
For 2,4,4,4,5,5,7,9, squared deviations sum to 32. Sample variance is 32/7 and SD is its square root, 2.1381. This is not mean absolute deviation.

Standard deviation is not standard error

One confusion causes more damage in applied work than any other idea in this lesson, and it is worth confronting before it can take root. The standard deviation describes how much individual observations vary around their mean, and it is a property of the data itself. The standard error describes how much a computed statistic, most commonly the sample mean, would vary from sample to sample if the study were repeated, and it is a property of an estimation procedure rather than of any individual. The two answer entirely different questions, and they are not interchangeable.

For the fictional data, s=sqrt(32/7)=2.1381. Under independent observations from a common population, the estimated standard error of their mean is s/sqrt(8)=0.7559. SD describes observed dispersion; SE describes sampling variability of an estimator. They are not interchangeable. For n>1 and s>0, this particular SE is smaller than s; when s=0 both are zero. Consecutive afternoons could be dependent, so the simple SE is a conditional model calculation, not proof of a valid real-world sampling design. [3]

Key idea: Standard deviation describes observation spread; standard error describes the sampling spread of a specified statistic. Substituting one for the other answers the wrong question. The direction of the numerical difference depends on the statistic and design.

Under an explicitly normal iid model with mean 5 and SD 2.14, the mean of eight has SE 2.14/sqrt(8)=0.7566. These curves are probability models, not fitted empirical histograms.
Under an explicitly normal iid model with mean 5 and SD 2.14, the mean of eight has SE 2.14/sqrt(8)=0.7566. These curves are probability models, not fitted empirical histograms.

Reading the standard deviation

A larger standard deviation means more spread. The standard deviation is always zero or positive, and it equals zero only when every value is identical (no spread at all). It carries the same units as the data (dollars, centimeters, hours), which is exactly why it is usually preferred over the variance for describing spread in plain language: a variance of 4 "square dollars" means nothing to a reader, but a standard deviation of 2 dollars does.

The standard deviation also feeds directly into the z-scores and the normal model of the next lesson, where "how many standard deviations from the mean" becomes the universal ruler for comparing any two values.

Common misconceptions

  • Forgetting the final square root. The quantity 32 / 7 = 4.57 is the variance, measured in squared students. The standard deviation is its square root, 2.14. Reporting 4.57 as a standard deviation roughly doubles the apparent spread.
  • Choosing a denominator without identifying the target. Divide by n-1 for the usual unbiased variance estimator under the iid finite-variance assumptions. Divide by n when describing the variance of a fully enumerated finite population. For these eight values the results are 32/7 and 32/8; neither denominator repairs a biased sample or dependence.
  • Averaging the raw deviations. Their sum is always exactly zero, so their average is always zero for every dataset. Squaring prevents cancellation; taking absolute values is another legitimate way to measure distance.
  • Confusing standard deviation with standard error. SD describes observation spread and SE describes sampling variation of a specified statistic. The estimated SE s/sqrt(n) is for an iid sample mean; its usual smaller size must not be generalized to every estimator or design.
  • Expecting the standard deviation to be resistant. It is built from squared distances to the mean, so a single extreme observation inflates it substantially. When a distribution is badly skewed, the interquartile range is the more honest companion to the median.

Recap

  • The range is the maximum minus the minimum; it is instantly interpretable, uses only two observations, and tends to grow with sample size.
  • The variance averages the squared deviations from the mean, and the standard deviation is its square root, which restores the original units.
  • For iid observations with finite variance, sample variance uses n-1 to estimate population variance without bias; n must be at least 2.
  • In this lesson, sigma and sigma squared denote population SD and variance, while s and s squared denote their sample counterparts. This is a notation convention, not a universal rule about Greek and Roman letters.
  • Standard deviation measures the spread of individual observations, while standard error measures the sampling variability of a statistic, and the two must never be interchanged.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. Is SD the arithmetic average of absolute distances?
  2. What conditions make s squared unbiased for population variance?
Check your reasoning
  1. No. SD uses squared deviations and a square root; mean absolute deviation is a different summary.
  2. Independent observations from a common distribution with finite variance, using n-1 and n at least 2.

Remember: The n-1 correction does not fix biased sampling, and the square root of an unbiased variance estimate is not generally unbiased.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 1.3.5.6: Measures of Scale. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Standard Deviation. Read the source.
  3. Altman and Bland (2005), Standard deviations and standard errors, BMJ. Read the source.
  4. NIST/SEMATECH, e-Handbook, 1.3.5.1: Measures of Location. Read the source.
Key terms
Range
The maximum value minus the minimum value.
Deviation
The difference between a data value and the mean.
Variance
The average of the squared deviations from the mean.
Standard deviation
The square root of the variance; the typical distance from the mean.
Degrees of freedom
The divisor n minus 1 used for a sample variance.
Bessel's correction
Dividing by n minus 1 to make the sample variance an unbiased estimate.
Mean absolute deviation
The average of the absolute deviations from the mean, an alternative spread measure.
Chebyshev's inequality
A rule guaranteeing a minimum fraction of any distribution within k standard deviations of the mean.

Z-Scores and the Normal Distribution

  • Compute a z-score and interpret it as a number of standard deviations from the mean.
  • State the 68-95-99.7 empirical rule for normal distributions.
  • Use z-scores to compare values measured on different scales and to find percentiles.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

A z-score expresses a value in standard-deviation units relative to a specified reference distribution. This requires a finite mean and a finite, positive standard deviation. Standardization removes units; it does not automatically make two tests, populations, or performances comparable or fair.

The anchor for this lesson is the Harbor High chemistry final, whose scores across the whole cohort have a mean of 70 points and a standard deviation of 8 points, and whose histogram is close enough to bell-shaped that the normal model is a reasonable approximation. Every calculation below refers to that examination, so the numbers accumulate into a single coherent picture rather than a sequence of disconnected exercises.

Key idea: Standardization expresses a value as a signed number of reference standard deviations from a reference mean. This provides a common numerical scale; deciding whether the resulting comparisons answer a fair or useful question still requires context.

In plain terms

Subtract the reference mean and divide by the reference standard deviation: z=(x-mu)/sigma. If sigma is zero, the formula is undefined; infinite-variance models also fall outside this definition. A z-score is a relative position. Converting it with the standard normal CDF requires a normal model. Empirical percentile ranks can instead be computed directly from ordered data without assuming normality. [4]

The z-score formula

For a value x from a distribution with a given mean and standard deviation, z = (x - mean) / (standard deviation). Read it in two steps: the numerator is the deviation (how far x is from the mean, in original units), and dividing by the standard deviation rescales that distance into standard-deviation units. A positive z means the value is above the mean; a negative z means below; z = 0 means exactly at the mean. Z-scores are unitless, which is precisely what lets them cross between scales.

Worked example. Test scores have a mean of 70 and a standard deviation of 8. A student scores 86. Then z = (86 - 70) / 8 = 16 / 8 = 2.0. The score is 2 standard deviations above the mean. Another student scores 64, giving z = (64 - 70) / 8 = -6 / 8 = -0.75, three quarters of a standard deviation below the mean.

Worked example: running the formula backwards. The relationship rearranges to x = mean + z x (standard deviation), which converts a position back into a raw score. A student one standard deviation above average scored 70 + 1 x 8 = 78 points. A student at z = -2 scored 70 + (-2) x 8 = 70 - 16 = 54 points. A student at z = 1.5 scored 70 + 1.5 x 8 = 70 + 12 = 82 points. This reversed calculation is not an afterthought, because some practical questions arrive in this form. Admissions offices, manufacturers, and clinicians all begin by choosing a percentile and then need the raw cutoff that corresponds to it, which means converting a position into a measurement rather than the other way round.

Key idea: Subtract the reference mean before dividing by the reference SD. The inverse transformation is x=mean+z x SD. It returns the measurement corresponding to a specified standardized position.

Scores 54,62,70,78,82,86 become z-scores -2,-1,0,1,1.5,2. Standardization requires a positive SD and does not establish normality or fairness.
Scores 54,62,70,78,82,86 become z-scores -2,-1,0,1,1.5,2. Standardization requires a positive SD and does not establish normality or fairness.

Comparing across scales

Z-scores shine when two things are measured differently. Suppose you earn 650 on an exam with mean 500 and standard deviation 100, so z = (650 - 500) / 100 = 1.5. A friend earns 86 on the test above (z = 2.0). Even though 650 is a much bigger raw number than 86, your friend's z-score of 2.0 beats your 1.5, so relative to each group, your friend performed better. Raw scores across different tests are apples and oranges; z-scores make them comparable.

Two cautions belong with that comparison. First, a negative z-score carries no stigma, because it reports a position rather than a grade. A golfer whose round has z = -2 is performing superbly, since low scores win golf. Second, a fair comparison requires that both groups be genuinely comparable reference populations. Comparing a z-score computed within a class of six against one computed within a national cohort of sixty thousand compares two very different things, and the arithmetic will not warn you.

Key idea: The sign of a z-score reports direction and its magnitude reports distance, but whether a large z is good news depends entirely on the variable and on which reference group produced the mean and standard deviation.

The normal distribution

The normal distribution is a symmetric, bell-shaped model that describes a remarkable range of natural measurements: heights, birth weights, measurement errors, and (thanks to the Central Limit Theorem in Module 3) the behavior of sample means. It is completely determined by two numbers, its mean (which locates the center) and its standard deviation (which sets the width). The special case with mean 0 and standard deviation 1 is the standard normal distribution, and its values are simply z-scores. When data is approximately normal, z-scores unlock precise statements about how common or rare a value is. [1]

Normality is a modeling assumption. Histograms and normal probability plots can reveal problems, but a small sample rarely establishes the form of an entire population, especially its tails. Examine how the observations were generated and whether mixtures, bounds, outliers, or dependence undermine the intended normal approximation. Model-based probabilities remain conditional on that model.

Key idea: The normal distribution is a model chosen for a dataset rather than a property that data automatically possesses, so check the shape before importing any bell-curve percentage.

The 68-95-99.7 empirical rule

For a normal distribution, the empirical rule gives quick, memorable benchmarks:

  • About 68% of values lie within 1 standard deviation of the mean (between z = -1 and z = +1).
  • About 95% lie within 2 standard deviations.
  • About 99.7% lie within 3 standard deviations.

Applying the rule. With mean 70 and standard deviation 8, about 68% of scores fall in 70 plus or minus 8, that is between 62 and 78. About 95% fall between 70 plus or minus 16, that is 54 to 86. A score of 86 (z = 2) therefore sits right at the edge of the middle 95%.

Worked example: slicing the rule into tails. Under the stated normal model, symmetry divides each two-sided outside probability equally between tails. The rounded 68% rule gives about 16% per tail outside 62 to 78; the rounded 95% rule gives about 2.5% per tail outside 54 to 86. Direct normal calculation gives P(score>86)=P(Z>2)=0.0227501, or about 2.275%. The rounded 99.7% rule gives about 0.15% in each tail beyond 46 and 94. These are model probabilities. Whether a rounded rule is accurate enough depends on the calculation and decision.

Key idea: Each empirical-rule percentage becomes two tail percentages by subtracting from 100 and halving, and that one manoeuvre answers most bell-curve questions without any table at all.

From z-scores to percentiles

A percentile is a quantile value; a percentile rank describes a cumulative position. For a normal model, P(Z <= 2)=0.9772499, so a score of 86 in the stated normal model is near the 97.725th percentile. The empirical-rule calculation gives about 97.5%, a rougher mental estimate. These are model probabilities, not the exact fractions in a finite observed class. [2] [3]

Similarly, a value exactly at the mean (z = 0) sits at the 50th percentile, and a value at z = -1 sits near the 16th percentile (since 68% is in the middle, 16% falls in each tail). For z-scores that are not whole numbers, statisticians read a standard normal table or use software, but the empirical rule handles the common benchmark cases in your head.

Worked example: setting a cutoff from a percentile. Suppose Harbor High wants to award distinction to the top 2.5 percent of the cohort. That percentile corresponds to z = 1.96, because the central 95 percent of a normal curve lies between -1.96 and +1.96, leaving 2.5 percent in the upper tail. Converting back to raw points gives x = 70 + 1.96 x 8 = 70 + 15.68 = 85.68, so the cutoff is a score of about 86. Three landmark values do most of this work in practice and are worth memorising: z = 1.28 marks the 90th percentile, z = 1.645 marks the 95th, and z = 1.96 marks the 97.5th. The last of those reappears constantly in the confidence intervals of Module 4. [2]

Key idea: Forward questions run value to z-score to percentile, and reversed questions run percentile to z-score to value, with the z-scale serving as the shared middle step in both directions.

A standard normal upper tail beyond z=2 has probability 0.0227501. The corresponding cumulative percentage is 97.72499%, rather than the rough empirical-rule estimate 97.5%.
A standard normal upper tail beyond z=2 has probability 0.0227501. The corresponding cumulative percentage is 97.72499%, rather than the rough empirical-rule estimate 97.5%.

Common misconceptions

  • Getting the order of operations wrong. Subtract the mean first, then divide the entire difference by the standard deviation. Dividing before subtracting, or dividing only part of the difference, produces a meaningless number.
  • Dividing by the variance instead of the standard deviation. If a problem reports a variance of 64, take its square root to get a standard deviation of 8 before standardising. A z-score must be unitless, and points divided by points-squared is not.
  • Applying the empirical rule to skewed data. The 68, 95, and 99.7 percentages are properties of the bell curve, not of data in general. For incomes or waiting times, the fraction within two standard deviations can be very different.
  • Treating a negative z-score as a failure. The sign says which side of the mean a value falls on and nothing more. Whether below average is good depends entirely on the variable being measured.
  • Reading the rule's percentages as exact. The true figures are 68.27, 95.45, and 99.73 percent. The rounded versions are excellent for estimates, while tables and software supply exact areas when precision matters.

Recap

  • A z-score, computed as the value minus the mean divided by the standard deviation, expresses a measurement as a signed number of standard deviations from its own mean.
  • Because z-scores are unitless, they describe position relative to a reference distribution; comparability requires substantive justification.
  • A normal distribution is fully determined by its mean and standard deviation, and the standard normal has mean 0 and standard deviation 1.
  • The empirical rule places about 68, 95, and 99.7 percent of a normal distribution within one, two, and three standard deviations of the mean, and symmetry converts those into tail percentages.
  • Normality is an assumption to be checked, and normal-CDF percentile claims require a normal model, while empirical ranks can be read from data.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. When is a population z-score undefined?
  2. Can empirical percentile ranks be found without a normal model?
Check your reasoning
  1. When the required finite mean and finite positive SD do not exist, including SD zero.
  2. Yes, from ordered observations with a stated rank convention. Normal-CDF conversion is a separate model-based calculation.

Remember: A bell-shaped histogram is not proof of a normal population, and z-scores alone do not determine percentiles for arbitrary distributions.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 1.3.6.6.1: Normal Distribution. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Normal Distribution. Read the source.
  3. R Core Team, R-devel 4.6.0 documentation: Sample Quantiles. Read the source.
  4. Penn State STAT 500, Lesson 3: Probability Distributions. Read the source.
Key terms
Z-score
The number of standard deviations a value lies from the mean.
Standardizing
Converting a value to a z-score using (x - mean) / standard deviation.
Normal distribution
A symmetric, bell-shaped distribution described by its mean and standard deviation.
Empirical rule
For normal data, about 68%, 95%, and 99.7% of values lie within 1, 2, and 3 standard deviations.
Standard normal
The normal distribution with mean 0 and standard deviation 1, in which values are z-scores.
Percentile
The percentage of values at or below a given value.
Heavy tails
A distribution in which extreme values occur more often than the normal model predicts.

Module 3: Probability and Sampling

Build probability models, distinguish data and sampling distributions, and compute binomial probabilities and expected values.

Probability Basics

  • Compute the probability of an event for equally likely outcomes.
  • Apply the complement, addition, and multiplication rules.
  • Distinguish independent events from mutually exclusive events.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

Probability assigns numbers between 0 and 1 to events. An impossible event has probability 0, but the converse needs care: a particular point in a continuous model can have probability 0 and still be a possible value. Probability 1 means almost sure occurrence, which is not always logical certainty. In the finite fair die and card models in this lesson, every elementary outcome has positive probability, so the simpler impossible/certain reading works. [2]

The anchor for this lesson is game night at the Lakeside Community Center, where the equipment consists of one standard 52-card deck, one fair six-sided die, and one fair coin. Those three objects generate every calculation below, which keeps the arithmetic small enough to verify and makes the underlying structure visible rather than hidden behind an application.

Key idea: Probability assigns a number between 0 and 1 to an event, and the rules of this lesson describe how those numbers combine when events are joined by the words "not", "or", and "and".

In plain terms

Three connecting words drive almost every introductory probability question, and each has its own rule. The word "not" invokes the complement rule, which says that the probability an event fails to occur is one minus the probability that it occurs. The word "or" invokes the addition rule, which adds the individual probabilities and then subtracts the overlap, because outcomes belonging to both events would otherwise be counted twice. The word "and" invokes the multiplication rule, which multiplies the probabilities when the events do not influence one another, and multiplies by a conditional probability when they do. A fourth phrase deserves special attention because it appears constantly and looks harder than it is: whenever a question asks for the probability of "at least one" success, the fastest route is almost always to compute the probability of no successes at all and subtract that from one.

Basic definition and the sample space

The sample space is the set of all possible outcomes of a random process. An event is any subset of that space, some collection of outcomes we care about. When the outcomes are equally likely, the probability of an event A is P(A) = (number of outcomes in A) / (total number of outcomes).

Rolling a fair die, the sample space is {1, 2, 3, 4, 5, 6}, so P(rolling a 4) = 1 / 6. Drawing from a standard 52-card deck, P(a heart) = 13 / 52 = 1 / 4. Every probability obeys three basics: it lies between 0 and 1, the probability of the whole sample space is 1, and the probabilities of a complete set of non-overlapping outcomes add to 1.

Worked example: counting a sample space. Roll the Lakeside fair die independently twice and record the ordered pair of results. The first roll has 6 possible outcomes and the second has 6, so the sample space contains 6 x 6 = 36 equally likely ordered pairs. Now count the event "the two rolls sum to 7", which contains the pairs (1,6), (2,5), (3,4), (4,3), (5,2), and (6,1), a total of 6 outcomes. Therefore P(sum of 7) = 6 / 36 = 1 / 6, approximately 0.167. Compare that with the event "the two rolls sum to 12", which contains only the single pair (6,6), so P(sum of 12) = 1 / 36, approximately 0.028. A sum of 7 is six times as likely as a sum of 12, and the reason is visible in the counting rather than hidden in a formula.

Key idea: When outcomes are equally likely, every probability question reduces to two counts, and the difficulty lies entirely in counting the sample space correctly.

The complement rule

The complement of A, written "not A," is everything in the sample space in which A does not happen. Because A either happens or it does not, P(not A) = 1 - P(A). If the chance of rain is 0.30, the chance of no rain is 1 - 0.30 = 0.70. The complement rule is the go-to shortcut whenever a question contains the phrase "at least one," because "at least one" is the complement of the often much simpler event "none."

Worked example. Drawing one card from the Lakeside deck, the probability of a face card (jack, queen, or king) is 12 / 52 = 3 / 13, approximately 0.231. The probability of not drawing a face card is therefore 1 - 3/13 = 10/13, approximately 0.769. Verify it directly by counting: there are 52 - 12 = 40 non-face cards, and 40 / 52 = 10 / 13. The two routes agree, which is the point of the rule, since the subtraction is faster whenever the complement is easier to describe than the event itself.

Key idea: An event and its complement partition the sample space, so their probabilities always sum to exactly 1, which turns any hard "at least" question into an easier "none" question.

The addition rule

For the probability that A or B occurs (meaning at least one of them), P(A or B) = P(A) + P(B) - P(A and B). You subtract the overlap because outcomes counted in both A and B would otherwise be double-counted. Two events are mutually exclusive (disjoint) if they cannot both happen at once; then P(A and B) = 0 and the rule simplifies to P(A) + P(B). [4]

Worked example. Draw one card. Find P(King or Heart). There are 4 kings and 13 hearts, but the king of hearts belongs to both, so it must not be counted twice: P(King or Heart) = 4/52 + 13/52 - 1/52 = 16/52 = 4/13, about 0.31.

Contrast that with a pair of events that genuinely cannot overlap. Drawing one card, the events "the card is a heart" and "the card is a spade" are mutually exclusive, because no card belongs to both suits. Here the overlap term is zero, so the rule collapses to P(heart or spade) = 13/52 + 13/52 = 26/52 = 1/2. The general lesson is that you should always check whether an overlap exists before deciding which version of the rule applies, since forgetting to subtract a real overlap inflates the answer, and subtracting an overlap that does not exist deflates it.

Key idea: Add the probabilities and subtract the overlap, remembering that the overlap term is zero only when the events genuinely cannot occur together.

The red-and-king overlap contains two cards. Adding 26 red cards and four kings double-counts those two, so the union has 28 of 52 cards.
The red-and-king overlap contains two cards. Adding 26 red cards and four kings double-counts those two, so the union has 28 of 52 cards.

The multiplication rule and independence

For the probability that A and B both occur, when the events are independent (one happening does not change the other's chance), P(A and B) = P(A) x P(B). Flipping a fair coin twice independently, P(two heads) = 0.5 x 0.5 = 0.25. [1]

Independence and disjointness describe different properties. Two disjoint events with positive probabilities are dependent because P(A and B)=0 differs from P(A)P(B)>0. A zero-probability event is an exception to that conclusion. For P(A)>0, the general multiplication rule is P(A and B)=P(A) x P(B given A). For independent events the conditional factor equals P(B). Drawing cards without replacement illustrates a conditional calculation because the first draw changes the remaining deck.

Worked example: with and without replacement. Draw two cards from the Lakeside deck and ask for the probability that both are hearts. If the first card is returned and the deck reshuffled, the draws are independent and P(both hearts) = (13/52) x (13/52) = (1/4) x (1/4) = 1/16 = 0.0625. If the first card is kept, the second draw faces a 51-card deck containing only 12 hearts, so P(both hearts) = (13/52) x (12/51) = (1/4) x (12/51) = 12/204 = 1/17, approximately 0.0588. The second answer is smaller because removing a heart makes another heart slightly less likely. The gap is modest here, but in small populations it becomes decisive, and assuming independence when sampling without replacement from a small group is a genuine source of wrong answers.

Key idea: Independence means P(A and B)=P(A)P(B). Disjointness means the overlap is empty. Two disjoint events with positive probabilities are dependent, because observing one rules out the other. They are not logical opposites: events can be neither disjoint nor independent, and a zero-probability event can satisfy the independence equation while being disjoint from another event. [3]

Combining the rules

The real skill is recognizing which rule a problem needs, and many problems chain several together. "At least one head in two flips" is far easier by complement than by listing cases: P(at least one head) = 1 - P(no heads) = 1 - (0.5 x 0.5) = 1 - 0.25 = 0.75. The pattern generalizes: the probability of at least one success in n independent tries is 1 - (probability of failure)^n.

For example, the chance of rolling at least one six in four rolls of a fair die is 1 - (5/6)^4 = 1 - 0.482 = 0.518, a little better than even. Spotting that "at least one" invites the complement, and that "and" with independence invites multiplication, resolves the large majority of introductory probability questions.

Key idea: The probability of at least one success in n independent attempts equals 1 minus the failure probability raised to the power n, which is the single most reusable formula in this lesson.

Common misconceptions

  • Confusing independent with mutually exclusive. Independent means one event carries no information about the other. Mutually exclusive means they cannot both happen, which is maximal dependence. Two mutually exclusive events with non-zero probabilities are never independent.
  • Forgetting to subtract the overlap. Adding 4/52 and 13/52 without removing the king of hearts counts that single card twice and gives 17/52 instead of 16/52. Always ask whether any outcome satisfies both descriptions.
  • Multiplying when sampling without replacement. If the first item is not returned, the second probability has a different denominator and often a different numerator. Two hearts in a row is 1/17, not 1/16.
  • The gambler's fallacy. For independent flips, a fair coin that has landed heads five times running still has probability 0.5 of heads on the next flip. The coin has no memory, and independence means exactly that past outcomes carry no information about future ones.
  • Enumerating unordered pairs when order matters. The 36-outcome sample space for two dice treats (2,5) and (5,2) as distinct, which is what makes the outcomes equally likely. Collapsing them to 21 unordered pairs destroys that equal likelihood and gives wrong answers.

Recap

  • Probability runs from 0 to 1, and for equally likely outcomes it equals the count of favourable outcomes divided by the size of the sample space.
  • The complement rule states that P(not A) equals 1 minus P(A), which is the standard shortcut for any question phrased as "at least one".
  • The addition rule adds P(A) and P(B) and subtracts P(A and B). The subtracted term is zero when the intersection has probability zero, including disjoint events.
  • The multiplication rule for "and" multiplies the probabilities when the events are independent, and uses a conditional probability when they are not.
  • Independence and disjointness describe different properties. Disjoint events with positive probabilities cannot be independent.

Conditional probability and base rates

For P(B)>0, P(A|B)=P(A and B)/P(B). Reversing the condition changes the denominator. In a fictional batch of 1,000 messages, 100 are spam. A filter flags 80 of the spam messages and 90 of the 900 legitimate messages. Its sensitivity is 80/100=0.80, but the probability a flagged message is spam is 80/(80+90)=0.4706. The 0.80 and 0.4706 answer different questions. A tree or two-way table makes the denominators visible. [1]

For n independent trials with the same success probability p, the probability of at least one success is 1-(1-p)^n. The complement rule itself always holds; this product formula for no successes requires the independence and common-p assumptions. Without replacement from a small finite batch, conditional probabilities change from draw to draw.

In the fictional filter example, sensitivity is 80/100=0.80, but only 80 of 170 flagged messages are spam, giving 0.4706. These condition on different groups.
In the fictional filter example, sensitivity is 80/100=0.80, but only 80 of 170 flagged messages are spam, giving 0.4706. These condition on different groups.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. Are independence and disjointness opposites?
  2. Why does P(spam|flagged) differ from P(flagged|spam)?
Check your reasoning
  1. No. Disjoint positive-probability events are dependent, but events can have neither property; zero-probability cases also need care.
  2. Their conditioning groups and denominators differ. The base rate enters the first probability.

Remember: Independence is a probability factorization, not a claim of no causal influence inferred from data. Conditional probabilities require a positive-probability conditioning event.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. Orloff and Bloom, MIT 18.05 (Spring 2022), Reading 3: Conditional Probability, Independence and Bayes Theorem. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Uniform Distribution. Read the source.
  3. OpenStax (2023), Introductory Statistics 2e, 3.2: Independent and Mutually Exclusive Events. Read the source.
  4. OpenStax (2023), Introductory Statistics 2e, 3.3: Two Basic Rules of Probability. Read the source.
Key terms
Probability
A number from 0 to 1 giving the chance an event occurs.
Event
A specified set of outcomes of a random process.
Sample space
The set of all possible outcomes of a random process.
Complement
The event that A does not happen; its probability is 1 minus P(A).
Mutually exclusive
Events that cannot both occur at the same time.
Independent events
Events for which one occurring does not change the probability of the other.
Addition rule
P(A or B) = P(A) + P(B) - P(A and B).
Conditional probability
The probability of one event given that another has occurred.

Sampling and Sampling Distributions

  • Describe common sampling methods and the bias that poor sampling creates.
  • Explain what a sampling distribution of the mean is.
  • Compute the standard error of the mean and interpret it.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

Inference works only if the sample fairly represents the population it comes from. This lesson covers two linked ideas: how to sample well so your data is trustworthy, and how a sample statistic such as the mean behaves when you imagine repeating the study many times. That second idea, the sampling distribution, is the conceptual heart of all inference.

The anchor is the Cedar County screen-time survey, a study attempting to estimate the average number of minutes county residents spend looking at a phone each day. Suppose that, unknown to anyone conducting the study, the true population standard deviation is 15 minutes. That figure is a parameter, so in reality nobody would know it, but pretending to know it here makes the behaviour of the sampling distribution visible in a way that would otherwise remain abstract.

Key idea: Sampling design determines which population is represented and which repeated-sampling calculation is appropriate. Random selection supports design-based inference; it does not guarantee a representative realized sample or eliminate measurement error and nonresponse.

In plain terms

Keep selection and sampling variation separate. Selection determines which population and model a sample can support; more observations alone do not cure coverage, response, or measurement problems. A sampling distribution describes how a statistic varies under a specified repeated sampling process. For an iid sample mean with finite positive variance, the mean is centered on the population mean and its SE is sigma/sqrt(n). Other designs or statistics require their own calculations.

Sampling methods

A simple random sample of size n without replacement assigns equal probability to every possible n-member subset of a defined population. Equal individual inclusion probabilities alone are not sufficient to define a simple random sample. The sampling frame must cover the intended population, and response and measurement processes must also be assessed. [1]

Stratified sampling selects within defined strata. If sampling fractions differ, estimate the population mean by weighting stratum means by their population shares. Cluster sampling selects groups and may observe all or a subsample of their members. Systematic sampling starts randomly and selects at a regular interval; periodic ordering can affect its performance. These designs require variance calculations that reflect how selection occurred. [2]

Stratification can improve precision when it separates groups with different means and produces relatively homogeneous strata. It is not a universal improvement for every allocation. Clustering can reduce collection costs, but positive within-cluster similarity often reduces effective information. The direction and magnitude of that effect depend on the design and population. A student must identify the sampling unit before applying an iid formula.

Key idea: Stratification selects within strata; clustering selects groups. Neither label alone establishes precision, bias, or a valid standard-error formula.

Bias and its sources

Bias is a systematic tendency to over- or under-represent part of the population, and unlike random error it does not shrink as the sample grows. A convenience sample (just whoever is easy to reach) is the classic source: an online poll captures only people who visit that site and choose to respond.

Undercoverage leaves parts of a target population off the sampling frame. Nonresponse can bias estimates when response relates to the measured outcome and is not adequately handled. Voluntary samples can overrepresent people motivated to respond. Collecting more observations under the same flawed process does not automatically remove these errors. Weighting or modeling may help under stated assumptions, but cannot recover missing information without assumptions.

Key idea: Bias is a systematic error in the selection procedure, so it does not shrink as the sample grows, and a self-selected sample of ten million estimates the self-selected group very precisely and the population not at all.

The idea of a sampling distribution

A single sample gives one value of a statistic, such as one sample mean x-bar. If you drew a fresh random sample, you would get a slightly different x-bar, and a third sample a different one again. The sampling distribution of the mean is the distribution of x-bar over all possible samples of a fixed size n from the population. It is a distribution not of raw data but of a statistic, and it has three properties that make inference possible:

  • Center under iid sampling: With a finite population mean, the sample mean has expectation mu. This is an expectation over the stated sampling process, not a guarantee about one observed mean.
  • Spread under iid sampling: With finite positive variance and n>1, the sample mean has SD sigma/sqrt(n), smaller than the individual SD. Dependence and other sampling designs require separate formulas.
  • Shape under the classical CLT: For iid observations with finite positive variance, the standardized mean approaches normal in distribution. No universal sample size guarantees an accurate tail approximation.

Worked example: three fictional sample means. Suppose the model population mean is 100 minutes. Three independently drawn samples of 25 observations produce means 97,104,99. Their average is (97+104+99)/3=100 in this deliberately chosen illustration. Three sample means do not prove unbiasedness, and another set of three need not average exactly 100. Under iid sampling with a finite mean, unbiasedness follows from the expectation of the sample mean. Repeated simulation can illustrate the distribution, while exact enumeration is possible in small finite examples.

Notice carefully what kind of object this is. A histogram of the 25 residents in one sample displays raw screen times, and its spread reflects how much individuals differ from one another. The sampling distribution displays sample means, and its spread reflects how much a study's answer would move if the study were repeated. Those are different distributions describing different things, and conflating them is the source of the standard deviation and standard error confusion introduced two lessons ago.

Key idea: A sampling distribution is a probability distribution of a statistic under a specified sampling process. It can sometimes be calculated exactly, approximated mathematically, or explored by simulation. It is different from the distribution of individual observations.

For iid normal observations with mean 100 and SD 15, means of 25 and 100 observations have SDs 3 and 1.5. The curves show statistics across repetitions, not individual data.
For iid normal observations with mean 100 and SD 15, means of 25 and 100 observations have SDs 3 and 1.5. The curves show statistics across repetitions, not individual data.

Standard error of the mean

For independent, identically distributed observations with population SD sigma, SE(x-bar)=sigma/sqrt(n). Estimate it with s/sqrt(n) when sigma is unknown and the conditions apply. The SE is a standard deviation across hypothetical samples; it is not the mean absolute error of an estimate. [3] [4]

Worked example. If sigma=15 and n=25, SE=3. At n=100, SE=1.5. To target SE=0.75 under the same iid model, solve 15/sqrt(n)=0.75, giving n=400. This is an SE target, not a 95% margin of error or an adjustment for anticipated nonresponse.

For a simple random sample without replacement from a finite population of N values, define sigma using denominator N. Then the exact SD of the sample mean is (sigma/sqrt(n)) sqrt((N-n)/(N-1)). If N=100, n=25, and sigma=15, the correction is sqrt(75/99) and SE is about 2.611. If n=N, sampling uncertainty for that finite-population mean is zero, although measurement error can remain. [1]

When n/N is small, the correction is near one. In clustered, weighted, or time-series data, use a design-appropriate method. Increasing the number of repeated measurements of a few people is not equivalent to independently sampling that many people.

For a finite population of N=100 with denominator-N SD 15, the without-replacement SE is (15/sqrt(n))*sqrt((100-n)/99), reaching zero at a complete census.
For a finite population of N=100 with denominator-N SD 15, the without-replacement SE is (15/sqrt(n))*sqrt((100-n)/99), reaching zero at a complete census.

Common misconceptions

  • Believing a large sample fixes bias. A very large opt-in survey can estimate the average of its respondents precisely while misrepresenting its intended population. Sample size, selection, measurement, and response must be assessed separately.
  • Confusing distributions. A data distribution concerns observations; a sampling distribution concerns a statistic under repeated sampling. For an iid mean with finite positive variance and n>1, its SD is sigma/sqrt(n). That result is not a universal formula for every statistic or dependent sample.
  • Expecting the sample mean to equal the population mean. An unbiased estimator is correct on average across all possible samples, not correct in any particular sample. Sampling variability is normal and expected.
  • Mixing up designs. State whether the randomly selected units are individuals within every stratum or entire groups. Use the actual design, weights, and dependence when estimating uncertainty.
  • Assuming population size drives sample size. For small sampling fractions and otherwise comparable designs, population size has little effect on precision. Finite-population corrections and design effects can change that comparison.

Recap

  • Probability sampling methods, including simple random, stratified, cluster, and systematic designs, all use chance to decide who is selected, supporting probability-based inference when coverage, response, and analysis are appropriate.
  • Bias is a systematic tendency to misrepresent the population, and unlike random error it does not diminish as the sample grows.
  • The sampling distribution of the mean is the distribution of x-bar across all possible samples of a fixed size, and it is a distribution of a statistic rather than of raw data.
  • For iid observations with finite positive variance and n>1, the sample mean has expectation mu and SD sigma/sqrt(n). Its standardized distribution approaches normal under the classical CLT; this is not an exact finite-sample shape guarantee.
  • For iid observations with fixed finite variance, quadrupling n halves the SE of the mean. Finite-population and dependent designs need appropriate adjustments.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What is a sampling distribution?
  2. Does equal individual inclusion probability by itself define an SRS?
Check your reasoning
  1. The probability distribution of a statistic under a specified repeated-sampling mechanism.
  2. No. In an SRS without replacement every subset of the specified size has equal probability.

Remember: Stratification and clustering require design-aware weights and variance calculations. More rows do not necessarily mean more independent information.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. Penn State STAT 506, Lesson 1: Population Mean and Total under SRS. Read the source.
  2. Penn State STAT 500, Lesson 1: Collecting and Summarizing Data. Read the source.
  3. Orloff and Bloom, MIT 18.05 (Spring 2022), Reading 6b: Central Limit Theorem and Law of Large Numbers. Read the source.
  4. Altman and Bland (2005), Standard deviations and standard errors, BMJ. Read the source.
Key terms
Simple random sample
A sample in which every individual has an equal chance of being chosen.
Bias
A systematic error that makes a sample unrepresentative of the population.
Sampling distribution
The distribution of a statistic over all possible samples of a given size.
Unbiased estimator
A statistic whose sampling distribution is centered on the parameter it estimates.
Standard error
The standard deviation of a statistic under a specified sampling process.
Stratified sampling
Dividing the population into groups and randomly sampling within each.
Convenience sample
A non-random sample of whoever is easiest to reach, prone to bias.
Cluster sampling
Randomly selecting whole pre-existing groups and measuring everyone in them.

The Central Limit Theorem

  • State the Central Limit Theorem in your own words.
  • Explain why the normal model applies to sample means even for non-normal populations.
  • Use the CLT to find the probability that a sample mean lands in a range.

The Central Limit Theorem explains why a normal approximation can sometimes describe averages of nonnormal observations. Its usefulness depends on its conditions and on what is being approximated. It does not make raw data normal or repair a biased sample.

In plain terms

Imagine collecting many independent samples of the same size from one fixed population. Compute one mean for each sample. A graph of these means describes a different object from a graph of the observations in a single sample. Increasing the number of simulated samples makes that graph more stable; increasing the number of observations inside each sample changes the sampling distribution itself. Keep those two counts separate.

Before continuing, retrieve two earlier ideas: SD describes the spread of observations, while SE describes the spread of a statistic across hypothetical repetitions. Also distinguish a population parameter from the statistic used to estimate it. These distinctions identify exactly what the theorem concerns.

Statement of the theorem

In the classical iid version, X1,...,Xn are independent and identically distributed with finite mean mu and finite positive variance sigma squared. As n grows, the distribution of Z_n=(x-bar-mu)/(sigma/sqrt(n)) converges to the standard normal distribution. Equivalently, at a sufficiently large n for the intended use, the sample mean can be approximated by a normal distribution with mean mu and SD sigma/sqrt(n). [1]

The centering and variance statements are exact under these iid finite-variance conditions: E(x-bar)=mu and Var(x-bar)=sigma^2/n. The normal shape is the limiting approximation. The theorem itself does not specify that 30 observations will make every tail probability accurate. The population shape and the region of the distribution being used matter.

Why standardize? Without scaling, the mean becomes concentrated near mu as n increases. Standardization lets us compare the shrinking distributions on a common scale. The theorem says their standardized shapes approach the same normal curve, not that their unscaled spread stays fixed.

What the theorem does not say

Raw observations drawn from an exponential population remain exponential no matter how many are collected. The means of samples from that population can have a much less skewed sampling distribution. A histogram of 1,000 observations and a histogram of 1,000 sample means therefore answer different questions.

Independence cannot be established by looking at a bell-shaped histogram. Adjacent readings from a drifting instrument may be correlated. Heavy-tailed populations without finite variance fall outside this classical theorem. Symmetry alone is insufficient: the Cauchy distribution is symmetric but lacks a finite population mean and variance. [4]

Nor does averaging cure selection bias. If a recruitment process systematically omits part of the target population, increasing n may concentrate an estimate around the wrong target. The CLT describes variability under a sampling model; it does not validate that model or the population claim.

Exact distributions of standardized means from iid exponential waiting times are plotted for n=1,5,25. Their shapes approach the normal reference as n grows; the exponential population remains unchanged.
Exact distributions of standardized means from iid exponential waiting times are plotted for n=1,5,25. Their shapes approach the normal reference as n grows; the exponential population remains unchanged.

Why it matters

When an appropriate normal approximation holds, an average can be standardized with its standard error. This gives approximate probabilities and helps justify some confidence intervals and tests. When the population SD is unknown, replacing it with a sample estimate adds uncertainty. The t procedures in the next module address this in the normal model and are used approximately under other suitable conditions.

Write the random quantity before choosing a denominator. For one observation, use sigma when computing a population z-score. For the mean of n iid observations, use sigma/sqrt(n). For a proportion, regression coefficient, or paired difference, use the uncertainty formula appropriate to that statistic. One standard-error formula cannot be applied to every problem.

Worked example

Explicit normal model. For this fictional calculation, suppose independent loaf weights are normally distributed with mean 100 g and SD 15 g. This is a stated model, not an inference from a bakery dataset. For one loaf, P(X>106)=P(Z>0.4)=0.34458. For the mean of 25 loaves, SE=15/5=3 g and P(x-bar>106)=P(Z>2)=0.02275. [2]

Both probabilities are exact within this normal model, apart from displayed rounding. No CLT approximation is needed, because a mean of independent normal observations is itself normal. If only the mean and SD of a skewed population had been supplied, the individual probability 0.34458 would not follow. Mean and SD do not determine an arbitrary distribution. [2]

The difference between these probabilities comes from averaging. A single loaf can exceed the threshold relatively often, while a batch average must combine 25 values and has less spread. This does not imply every batch contains ordinary observations or that no very large loaf is possible.

A second look at the role of n

Explicit nonnormal model. Let each independent waiting time follow an exponential distribution with mean 10 minutes and SD 10 minutes. This is an illustrative probability model, not a claim that all waiting times are exponential. The SE of a mean of 25 is 2 minutes. The CLT approximation gives P(x-bar>14) approximately P(Z>2)=0.02275. The exact gamma-model probability is about 0.03237, demonstrating a visible tail error even with 25 observations. [3]

The figures compare standardized means from this model at several n values using a fixed random seed. The simulation is evidence about this specified model, not a universal sample-size rule. Inspect the tail you actually need, compare with an exact calculation where available, and report whether a probability is exact, approximated, or simulated.

In R, set.seed(20261105); z <- replicate(10000, (mean(rexp(25,rate=0.1))-10)/2); mean(z>2) estimates the tail by simulation. Its answer fluctuates. If the true tail probability is p and the repetitions are independent, the Monte Carlo SE of the estimated proportion is sqrt(p(1-p)/10000). More repetitions reduce simulation error, not the approximation error of using a normal distribution at a fixed sample size.

For iid exponential waits with mean and SD 10, the mean of 25 has exact upper-tail probability 0.032374 above 14. The normal approximation gives 0.022750, illustrating finite-sample tail error.
For iid exponential waits with mean and SD 10, the mean of 25 has exact upper-tail probability 0.032374 above 14. The normal approximation gives 0.022750, illustrating finite-sample tail error.

Law of large numbers and limits

The law of large numbers concerns a sample average approaching its expectation under appropriate assumptions. The CLT concerns the shape of its centered and scaled fluctuations. A running average need not move monotonically closer to the population mean after every new observation. It can move farther away on a particular update while still converging in the long run.

For a finite population sampled without replacement, use the finite-population correction described in the sampling lesson. For dependent observations, a suitable dependence model or sampling design is needed. Other central limit theorems exist, but their conditions and variances are not supplied merely by calling a dataset large.

Common misconceptions

  • Increasing the number of raw observations does not transform their underlying population into a normal distribution.
  • n=30 is not a guarantee of accurate normal-tail probabilities.
  • A symmetric population need not satisfy the finite-variance assumption.
  • A standard error concerns a specific estimator and design, not all numerical summaries.

Recap

State the sampling model, identify the statistic, calculate its center and standard error, and distinguish exact normal results from asymptotic approximations. Evaluate whether the approximation is useful for the probability or interval actually needed.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What converges toward the normal distribution in the classical CLT?
  2. Does a running average move closer to mu after every new value?
Check your reasoning
  1. The centered sample mean divided by its standard error, under iid finite-positive-variance conditions.
  2. No. Long-run convergence does not imply monotone improvement.

Remember: The raw population does not become normal with more observations. Symmetry and n=30 do not establish all classical CLT conditions.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. Orloff and Bloom, MIT 18.05 (Spring 2022), Reading 6b: Central Limit Theorem and Law of Large Numbers. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Normal Distribution. Read the source.
  3. R Core Team, R-devel 4.6.0 documentation: Exponential Distribution. Read the source.
  4. NIST/SEMATECH, e-Handbook, 1.3.5.6: Measures of Scale. Read the source.
Key terms
Central Limit Theorem
In the classical iid finite-positive-variance form, convergence of the standardized sample mean to a standard normal distribution.
Approximately normal
Close enough to a normal distribution to use normal-based methods.
Standard error
The standard deviation of a statistic under a specified sampling process.
Rule of thumb (n >= 30)
A common guideline for when the CLT approximation is adequate.
Standardize
Convert x-bar to a z-score using its mean and standard error.
Sampling distribution of the mean
The distribution of x-bar across all samples of size n.
Law of Large Numbers
The result that the sample mean converges to the population mean as n increases.

Random Variables, Expected Value, and the Binomial Model

  • Check whether a fixed-trial binomial model fits a stated process.
  • Calculate exact binomial probabilities, expected counts, and standard deviations.
  • Distinguish model probability, long-run expectation, and the result of one observed batch.

Probability rules describe events. A random variable turns an uncertain outcome into a numerical value so we can describe its distribution, expectation, and spread. Counting failures in a batch is a useful example because it connects probability to later inference for population proportions.

Specify the random variable

Consider ten independently manufactured components in a fictional model. Each has probability 0.20 of failing a specified test. Define X as the number that fail among those ten. The possible values are 0,1,...,10. The outcome for each component is binary, but X is a quantitative discrete count. The terms success and failure are coding conventions: a statistical success can mean a component failed.

A probability mass function assigns P(X=x) to each possible discrete value. Probabilities are nonnegative and add to one. A cumulative distribution function gives P(X<=x). It accumulates mass and never decreases. Keep an exact count probability separate from a cumulative probability, since a command returning one does not answer the other question.

The binomial conditions

The binomial model has a fixed number n of trials, two coded outcomes per trial, independent trials, and the same probability p for the coded success on every trial. We write X~Binomial(n,p). Independence concerns the joint process. Identical marginal failure rates do not establish independence if a shared machine fault can affect many components. [1]

Drawing ten items without replacement from a small finite batch changes the remaining composition after each draw, so the trials are dependent. A hypergeometric model may be appropriate. If the sample is a tiny part of a very large batch, a binomial approximation may be useful, but state that it is an approximation. Similarly, stopping when the third failure appears does not produce a fixed-n binomial count; the stopping rule changes the random variable.

Different failure probabilities across components also violate the common-p assumption. A model is a description of a data-generating process, not something to select merely because observations are labeled yes and no. Before using a formula, write one sentence for each condition and connect it to the scenario.

Derive an exact count probability

For k successes in n independent equal-probability trials, P(X=k)=choose(n,k) p^k (1-p)^(n-k). One specified ordering with k successes has probability p^k(1-p)^(n-k). The combinatorial coefficient counts how many distinct orderings have the same total. It is n!/[k!(n-k)!], with 0!=1. [2]

For exactly three failing components among ten, choose(10,3)=120. A particular ordering has probability 0.2^3 x 0.8^7=0.0016777216. Multiplying by 120 gives P(X=3)=0.201326592, about 20.13%. Omitting the coefficient would count only one ordering of the failures.

This formula is exact for the stated binomial model, not a claim that the model is an exact description of a real production process. Its arithmetic can be checked independently by listing probabilities for k=0 through 10 and verifying that they sum to one, allowing for floating-point rounding.

The Binomial(10,0.2) mass function sums to one. The count three has probability 0.2013266 and the expected count is two.
The Binomial(10,0.2) mass function sums to one. The count three has probability 0.2013266 and the expected count is two.

Cumulative probabilities and complements

At least one failure is the complement of no failures: P(X>=1)=1-P(X=0)=1-0.8^10=0.8926258176. The probability of at most two failures is the sum of the masses for 0,1,2, approximately 0.6777995264. Therefore P(X>2) is approximately 0.3222004736.

Watch inclusive endpoints. P(X>=3)=1-P(X<=2), whereas P(X>3)=1-P(X<=3). The count 3 belongs to the first event but not the second. Write the integer values in a small event before trusting a calculator expression. This avoids a common one-count error in software.

Expectation and variability

The expected value of a discrete random variable is E(X)=sum x P(X=x). It is a probability-weighted average, not the value a single trial must produce or necessarily the most likely value. In a binomial model, E(X)=np and Var(X)=np(1-p), so SD(X)=sqrt(np(1-p)). [3]

For n=10 and p=0.20, the mean count is 2, variance is 1.6, and SD is about 1.2649 components. For n=5 and p=0.30, the mean is 1.5, even though observing exactly 1.5 successes is impossible. Repeated independent batches can average toward 1.5 without any individual batch containing a fractional success.

One way to derive these formulas is to write X as the sum of n indicator variables, each equal to 1 for success and 0 otherwise. Each indicator has expectation p and variance p(1-p). Expectations add even without independence when they exist. Variances add in this simple way because the trials are independent; covariance terms would otherwise be needed.

For Binomial(5,0.3), the expected count is 1.5 and variance 1.05. The probability model has integer outcomes even though its expected value is fractional.
For Binomial(5,0.3), the expected count is 1.5 and variance 1.05. The probability model has integer outcomes even though its expected value is fractional.

Worked decision example

Suppose a fictional inspection costs $2 and always prevents a $5 loss when a component is defective. Assume a defect probability of 0.20 and no other costs or benefits. The expected prevented loss is 0.20 x $5=$1, giving expected net saving $1-$2=-$1 per inspection. Under this deliberately narrow model, inspection increases expected cost.

That calculation does not decide a real safety or quality policy. A rare defect could have consequences omitted from the dollar model, the inspection might be imperfect, and probabilities may be uncertain. Expected value answers a stated averaging question. A responsible decision also considers the distribution of consequences, constraints, and how well the model describes the setting.

Compute and simulate in R

Use dbinom(3,size=10,prob=0.2) for P(X=3), pbinom(2,10,0.2) for P(X<=2), and pbinom(2,10,0.2,lower.tail=FALSE) for P(X>2). The lower.tail argument changes which cumulative event is returned. It does not turn a cumulative function into a point probability. [2]

A reproducible simulation begins set.seed(20261105); counts <- rbinom(10000,size=10,prob=0.2). Then mean(counts) should be near 2, and mean(counts==3) near 0.2013. Different seeds can give different approximations. Exact formulas and simulated frequencies should agree within plausible simulation variation; simulation output is not required to equal the theoretical probability.

For the simulated fraction with exactly three failures, a rough Monte Carlo SE is sqrt(0.2013 x 0.7987 / 10000)=0.0040. Raising the number of simulated batches reduces that error but does not improve an inaccurate assumption about the real defect process.

Connection to sample proportions

If X counts successes out of n, the sample proportion is p-hat=X/n. Under the binomial conditions, E(p-hat)=p and SD(p-hat)=sqrt(p(1-p)/n). The later proportion-inference lesson uses this distribution to estimate an unknown p or test a specified p0. Distinguish the fixed model parameter p, the observed estimate p-hat, and the random count X. [4]

Normal approximations may work when both expected successes and failures are sufficiently large for the intended calculation. A threshold such as ten of each is a practical screening rule, not a universal theorem guaranteeing accurate tails. Exact binomial computation is often convenient and avoids that approximation, while still requiring the binomial model.

Recap

Define what is counted, justify n and p, check dependence and the stopping rule, write the event including its endpoints, and distinguish a model expectation from one observed count. These habits are more durable than memorizing a calculator sequence.

Common misconceptions

Exactly k and at least k are different events. A fixed-n count differs from a count under a stopping rule.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. Why is a binomial expected count allowed to be fractional?
  2. Which binomial assumption fails in a small-batch draw without replacement?
Check your reasoning
  1. It is an average across outcomes, not a possible count required in any one batch.
  2. Independence and the fixed success probability across successive draws generally fail.

Remember: Exactly k and at least k are different events. A fixed-n count differs from a count under a stopping rule.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 1.3.6.6.18: Binomial Distribution. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Binomial Distribution. Read the source.
  3. Orloff and Bloom, MIT 18.05 (Spring 2022), Reading 4b: Expected Value. Read the source.
  4. Penn State STAT 500, Lesson 3: Probability Distributions. Read the source.
Key terms
Random variable
A numerical function of a random outcome.
Probability mass function
The probability assigned to each possible discrete value.
Cumulative distribution function
The function giving P(X<=x).
Binomial model
A success count in fixed independent trials sharing one success probability.
Expected value
A probability-weighted average when it exists.
Indicator variable
A variable equal to one if an event occurs and zero otherwise.
Monte Carlo error
Random error caused by using finitely many simulated repetitions.
Sample proportion
The observed success count divided by the number of trials.

Module 4: Statistical Inference

Estimate means and proportions, interpret intervals and tests, and compare independent or paired means under stated conditions.

Confidence Intervals for a Mean

  • Explain what a confidence level means in terms of repeated sampling.
  • Construct a confidence interval for a population mean.
  • Interpret the margin of error and how sample size affects it.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

A single sample mean is a point estimate: our single best guess for the population mean. But a point estimate is almost never exactly right, and reporting it alone hides how uncertain it is. A confidence interval fixes this by reporting a whole range of plausible values, together with a stated level of confidence that the range captures the true parameter. It is the honest way to answer "what is the population mean?" because it reports both an estimate and its uncertainty in one statement.

The anchor is the Brookfield Library visit log. The library wants to know how long a typical visitor stays, so it times a random sample of 36 visitors and obtains a sample mean of 50 minutes. Suppose, for the sake of a clean first calculation, that the population standard deviation is known to be 12 minutes. That assumption is unrealistic and will be relaxed in the next lesson, but it isolates the logic of interval estimation from the additional complication of estimating variability.

Key idea: A confidence interval reports a range of parameter values consistent with the observed data, and the stated confidence level describes the reliability of the procedure that produced it. [4]

In plain terms

The symmetric intervals developed here have three ingredients: a point estimate, its standard error, and a critical multiplier. At a fixed sample and method, higher confidence gives a wider interval. A larger independent sample can improve precision, as can an efficient design or more precise measurement. These statements do not imply that every confidence interval in statistics is symmetric or uses this formula.

Structure of a confidence interval

The z and t intervals for a mean taught here have the form: point estimate plus or minus margin of error, where margin of error = (critical value) x (standard error). The point estimate centers the interval, the standard error measures how much the estimate bounces from sample to sample (from Module 3), and the critical value scales that bounce up to the confidence level you want. When the population standard deviation is known and the sampling distribution is normal, the critical value is a z-value read from the standard normal distribution. The three most common levels are: [1]

Confidence levelCritical z-value
90%1.645
95%1.96
99%2.576

These critical values come straight from the empirical rule and the normal curve: 95% of a normal distribution lies within 1.96 standard errors of center, which is exactly why 1.96 builds a 95% interval. [3]

Key idea: The critical value converts a desired confidence level into a number of standard errors, so 1.96 is not a magic constant but simply the point beyond which 2.5 percent of a normal curve lies in each tail.

Worked example

For this model calculation, assume independent normal observations and a known population standard deviation of 12 minutes. The exact coverage statement is conditional on those assumptions, not established by a fictional sample size alone.

A sample of n = 36 has a mean of x-bar = 50, and the population standard deviation is 12. Build a 95% confidence interval for the population mean.

  • Standard error = 12 / (square root of 36) = 12 / 6 = 2.
  • Critical value for 95% confidence is z = 1.96.
  • Margin of error = 1.96 x 2 = 3.92.
  • Interval = 50 plus or minus 3.92 = (46.08, 53.92).

We are 95% confident the true population mean lies between 46.08 and 53.92.

Under the stated iid normal model, the standard error of 2 minutes is the SD of repeated sample means around the fixed population mean. It is not the SD of differences between two independent study means; that would be sqrt(2^2+2^2)=2.828 minutes if both have SE 2. Multiplying 2 by the normal critical value 1.959964 gives a margin of about 3.92. The resulting interval is 46.08 to 53.92 minutes.

Key idea: Margin of error equals the critical value times the standard error, and these symmetric z and t intervals place that margin on either side of the estimate.

What "95% confident" really means

The confidence level describes the procedure under its stated assumptions. If we repeatedly drew iid normal samples and constructed the specified known-sigma 95% interval each time, its long-run coverage of the fixed population mean would be 95%. In a finite simulation the observed coverage fraction can differ from 95%. Approximate procedures need not achieve their nominal coverage exactly.

In a frequentist interpretation, the population mean is fixed and the random endpoints vary before data are collected. The observed interval either covers the parameter or does not. Its nominal 95% describes the procedure under its assumptions. A Bayesian credible interval answers a different probability question using a prior distribution and a likelihood. Do not attach the Bayesian reading to a frequentist interval without that additional modeling. [1]

A concrete picture helps. Imagine Brookfield ran the study one hundred times, each time drawing a fresh random sample of 36 visitors and constructing a 95 percent interval. Roughly 95 of those hundred intervals would contain the true mean, and roughly 5 would miss it entirely, and no one examining any single interval could tell which kind it was. The confidence level is a property of that manufacturing process, in the same way that a claim about a factory's defect rate describes the factory rather than the particular item in your hand.

The interval estimates a population mean. It does not claim that 95% of individual visitors or 95% of future sample means fall between its endpoints. Predicting a future individual or a future sample mean is a separate task with its own uncertainty calculation. In this frequentist interpretation, the computed interval and parameter are fixed; the confidence statement concerns the method across samples. Width describes precision under a model and does not establish study quality.

Key idea: Confidence describes the long-run coverage of the procedure across repeated samples; it is not the probability that this particular interval contains the parameter.

Forty independently simulated normal sample means with true mean 50 and SE 2 generate 95% z intervals. The realized coverage varies; 95% describes the procedure, not exactly 95% in every finite batch.
Forty independently simulated normal sample means with true mean 50 and SE 2 generate 95% z intervals. The realized coverage varies; 95% describes the procedure, not exactly 95% in every finite batch.

Width, confidence, and sample size

Two levers change the margin of error, and they pull against each other. Raising the confidence level (say to 99%) uses a bigger critical value, which widens the interval: more confidence costs precision, because to be surer of catching the mean you must cast a wider net. Increasing the sample size shrinks the standard error, which narrows the interval at any confidence level: more data buys precision.

For the same data at 90% confidence, the margin would be 1.645 x 2 = 3.29, giving the narrower interval (46.71, 53.29); at 99% it would be 2.576 x 2 = 5.15, giving the wider (44.85, 55.15). There is always a trade-off between how confident and how precise you want to be, and because the standard error falls only with the square root of n, buying a much narrower interval at a fixed confidence level requires a great deal more data.

Worked example: how many visitors would Brookfield need? Suppose the library wants a 95 percent interval with a margin of error no larger than 2 minutes rather than 3.92. Set 1.96 x (12 / sqrt(n)) = 2. Dividing both sides by 1.96 gives 12 / sqrt(n) = 1.0204, so sqrt(n) = 12 / 1.0204 = 11.76 and n = 138.3, which rounds up to 139 visitors. Compare that with the original 36. Cutting the margin of error roughly in half required nearly quadrupling the sample, which is the square-root law reappearing in a practical budget decision. Sample sizes are always rounded upward, because rounding down would leave the achieved margin slightly larger than the target.

Key idea: Increasing confidence widens a given z or t interval. More independent information or a better design can reduce its standard error. Simply repeating correlated measurements or increasing a biased sample is not the same improvement.

Common misconceptions

  • Assigning probability to a computed interval. Once the numbers are in, the interval either contains the parameter or it does not. The 95 percent lives in the procedure's long-run success rate, not in the single result.
  • Reading the interval as a range for individuals. The Brookfield interval estimates the mean visit length, not the visits themselves. Individual visitors vary far more widely than the interval suggests.
  • Believing a wider interval is better. Width measures uncertainty. A 99 percent interval is wider than a 95 percent interval computed from identical data, and it is not thereby a stronger finding.
  • Forgetting the design and model assumptions. A standard interval does not automatically account for selection bias, measurement errors, or unmodeled dependence. If its assumptions do not hold, its nominal coverage for the intended population is not guaranteed. A wider interval alone does not repair those problems.
  • Using overlap as a test. Separate confidence intervals do not give a direct interval or test for a difference. Use an appropriate comparison that includes the sampling variability and any dependence between estimates.

Recap

  • The symmetric z and t confidence intervals here take the form point estimate plus or minus margin of error, where the margin equals a critical value times the standard error.
  • Common critical values for a normal model are 1.645, 1.96, and 2.576 for 90, 95, and 99 percent confidence respectively.
  • Confidence describes the long-run coverage of the procedure across hypothetical repeated samples, not the probability that a specific computed interval contains the parameter.
  • Raising the confidence level widens the interval, while raising the sample size narrows it, under the stated model; efficient design and measurement can also improve precision.
  • Because the standard error falls with the square root of n, halving the margin of error requires roughly quadrupling the sample.

Unknown population spread: the t interval

Usually sigma is unknown. For independent observations from a normal population with n>=2, use x-bar +/- t_(0.975,n-1) s/sqrt(n) for an exact 95% t interval. Here x-bar=50, s=12, and n=36 give SE=2 and 35 degrees of freedom. The critical value is about 2.0301, so the interval is 50 +/- 4.0602, or (45.9398,54.0602). Using 1.96 with an estimated SD silently substitutes a different approximation. [2]

For large suitable nonnormal samples, the t interval may work approximately, but outliers, strong skew, and dependence require attention. R computes the interval with t.test(x,conf.level=0.95)$conf.int. A bootstrap interval resamples observed units and has its own assumptions, including which units can be treated as exchangeable. Resampling a biased or dependent dataset as if it were iid does not automatically correct the problem.

At estimate 50 and SE 2, the known-spread normal interval is about 46.0801 to 53.9199. The estimated-spread t interval with df=35 is 45.9398 to 54.0602.
At estimate 50 and SE 2, the known-spread normal interval is about 46.0801 to 53.9199. The estimated-spread t interval with df=35 is 45.9398 to 54.0602.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What does 95% confidence describe?
  2. When should the exact normal-population mean interval use t?
Check your reasoning
  1. The repeated-sampling coverage of the specified method under its assumptions, not a posterior probability assigned to one fixed interval.
  2. When sigma is unknown and estimated by s from iid normal observations; df=n-1.

Remember: Not all confidence intervals are symmetric. A bootstrap is not an assumption-free remedy for dependence or selection bias.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 1.3.5.2: Confidence Limits for the Mean. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Student t Test. Read the source.
  3. R Core Team, R-devel 4.6.0 documentation: Normal Distribution. Read the source.
  4. Penn State STAT 500, Lesson 5: Confidence Intervals. Read the source.
Key terms
Point estimate
A single-value best guess for a parameter, such as the sample mean.
Confidence interval
A range of plausible values for a parameter with an attached confidence level.
Confidence level
The long-run percentage of such intervals that capture the true parameter.
Margin of error
The critical value times the standard error; half the interval's width.
Critical value
The multiplier (such as z = 1.96) set by the confidence level.
Standard error
The standard deviation of a statistic under a specified sampling process.
Coverage probability
The actual long-run fraction of intervals that contain the parameter, ideally equal to the stated level.
Bootstrap
A resampling method that builds intervals directly from the data with minimal assumptions.

Hypothesis Testing: Logic and P-Values

  • State the null and alternative hypotheses for a claim.
  • Explain the meaning of a p-value and the significance level alpha.
  • Reach and state a test decision, and identify Type I and Type II errors.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

A hypothesis test compares a statistic with its reference distribution under a specified null model. A decision rule controls a stated error probability when its assumptions hold. The result can provide evidence against that model; it does not calculate the probability that the null is true or establish a scientific conclusion by itself.

The anchor is the Northwind bottling line, which is supposed to fill each bottle to a mean of 100 millilitres. Quality control suspects the machine has drifted in one direction or the other, so it measures 25 bottles and records a sample mean of 105 millilitres. The population standard deviation of the fill process is known from long experience to be 15 millilitres. Those four numbers generate every calculation in this lesson.

Key idea: A hypothesis test asks how surprising the observed data would be if a specified claim about the population were true, and answers with a probability rather than a verdict about that claim.

In plain terms

Specify the scientific question, null model, alternative, test statistic, and decision rule before inspecting results. A p-value measures the probability, under the null and other model assumptions, of a statistic at least as incompatible with that null as the observed statistic. The definition of extreme depends on the planned test. Small p-values can indicate incompatibility; they do not identify which assumption is wrong or assign a probability that a hypothesis is true. [1]

The two hypotheses

The null hypothesis specifies a claim or set of parameter values. A simple two-sided mean test might use H0:mu=100 versus Ha:mu!=100. A one-sided formulation can use H0:mu<=100 versus Ha:mu>100, with the boundary value 100 supplying the reference distribution for the usual test. Null hypotheses need not always mean no effect or contain only an equality. The design and question determine the hypotheses. [3]

The alternative is what you set out to demonstrate, so it should be chosen before seeing the data.

Test statistic and p-value

A test statistic summarizes a feature relevant to the chosen null and alternative. In this lesson's mean example, z expresses the difference from the null mean in standard-error units. Other tests use other summaries, such as squared count discrepancies or variance ratios. The p-value uses the statistic's null distribution and the planned definition of at least as extreme.

Read that definition carefully, because every word matters. The p-value is computed in a hypothetical world where the null holds, and it asks how surprising our data would be there. A small p-value means the data would be very unlikely if H0 were true, which counts as evidence against H0. A large p-value means the data is unremarkable under H0, so H0 survives.

What a p-value is not

In 2016 the American Statistical Association took the unusual step of issuing a formal statement on p-values, because misinterpretation had become widespread enough to distort published research across many fields. Three specific errors are worth naming and rejecting explicitly, since intro students who absorb them tend to carry them for years.

A p-value is not P(H0|data). It can summarize incompatibility of a statistic with H0 and the model assumptions, but does not calculate a posterior probability. Likewise, p=0.03 is not the probability that chance caused a result, that the analysis is correct, or that the alternative is true. Report the estimate, interval, design, and analytic choices alongside the p-value. [1]

What a p-value actually is remains narrow and useful: the probability, computed under the null hypothesis and the model's other assumptions, of obtaining a result at least as extreme as the one observed. The ASA's accompanying principles add that p-values do not measure the size or importance of an effect, that scientific conclusions should not rest on whether a p-value crosses a threshold, and that a p-value reported without the analysis choices that produced it is close to uninterpretable.

Key idea: A p-value is a statement about data given a hypothesis, never a statement about a hypothesis given data, and every common misreading consists of swapping those two around.

The decision rule

Before inspecting results, specify a significance level alpha and the complete procedure. For a valid level-alpha test, the probability of rejecting a true null is at most alpha under its assumptions. At alpha=0.05, the prespecified p-value rule is:

  • If the p-value is less than or equal to alpha, we reject H0; the result is called "statistically significant."
  • If the p-value is greater than alpha, we fail to reject H0; there is not enough evidence.

We deliberately say "fail to reject," never "accept," because absence of evidence is not evidence of absence. Not convicting a defendant does not prove them innocent; it only means the case was not strong enough.

A non-significant result does not establish that an effect is zero. It can occur when an effect is absent, small, or substantial relative to the decision context. Report the estimate and interval alongside the test. An interval spanning a trivial decrease and a large increase makes the unresolved magnitude visible; it does not establish equivalence.

Key idea: Failing to reject the null hypothesis means the evidence was insufficient, not that the null is true, and absence of evidence is not evidence of absence.

Worked example

For the following z calculation, assume iid normal bottle volumes with known population SD 15 ml. This explicit probability model supplies the normal reference distribution.

A machine is supposed to fill bottles to a mean of 100 ml, and we suspect it is off in either direction. Set H0: mean = 100 versus Ha: mean is not equal to 100. Suppose the population standard deviation is 15 ml, we sample n = 25 bottles, and the sample mean is x-bar = 105. The standard error is 15 / 5 = 3, so the test statistic is z = (105 - 100) / 3 = 5 / 3, approximately 1.67.

For a two-sided test at alpha = 0.05, the standard normal cutoffs are approximately -1.96 and 1.96. The unrounded statistic 5/3 is between them; its two-sided p-value is about 0.09558. We fail to reject H0 at this threshold. This result does not establish that the machine is calibrated or that its deviation is practically negligible. [4]

Retain unrounded intermediate values: 2*pnorm(-abs(5/3)) gives approximately 0.09558. Under the stipulated iid normal model with mean 100 and SD 15, this is the probability that a mean of 25 differs from 100 by at least 5 ml in either direction. It is not the probability that the machine is calibrated. Rounding z to 1.67 before evaluating the tail gives approximately 0.09492, illustrating why early rounding can change the reported p-value.

Key idea: For the continuous symmetric z and t tests here, the two-sided p-value is twice the appropriate one-tail probability beyond the observed absolute statistic. That shortcut is not a universal definition for asymmetric or discrete tests. Choose directionality from the question before viewing the data.

For the stipulated normal bottle model, the unrounded statistic is z=5/3. Its two-sided p-value is approximately 0.09558, using both tails beyond the observed absolute value.
For the stipulated normal bottle model, the unrounded statistic is z=5/3. Its two-sided p-value is approximately 0.09558, using both tails beyond the observed absolute value.

Two kinds of error, and the meaning of significance

A Type I error rejects a true null. A valid level-alpha procedure has rejection probability at most alpha under its null model; it equals alpha in some continuous exact tests and can be smaller in discrete tests. A Type II error fails to reject at a particular alternative, with probability beta. Power is 1-beta at that alternative, and changes with effect size, variability, design, and sample size.

For a fixed test family, sample size, model, and alternative, a smaller rejection region reduces both false-positive probability and power. Increasing independent information can improve power, but the effect depends on the design and model. Statistical significance describes crossing the test's decision threshold. It does not prove an effect exists or determine its practical importance.

Worked example: significance and importance. Suppose the fictional normal model has known sigma=15 ml, n=10,000, and x-bar=100.4 ml. Against mu0=100, SE=0.15 and z=2.6667, giving two-sided p approximately 0.00766. The observed difference is 0.4 ml. A small p-value does not establish whether that difference matters: the decision requires a stated tolerance, cost, or practical threshold. No claim about customers or regulations follows from this calculation.

Key idea: Power depends on the specified effect, variance, design, sample size, and procedure. A significant result can occur for a small effect, and an important effect can be missed. Report estimated magnitude, uncertainty, and the decision context.

Common misconceptions

  • Reading the p-value as the probability the null is true. It is computed by assuming the null is true, so it cannot measure that assumption's credibility. A p-value of 0.03 says nothing about a 3 percent chance of anything concerning the hypothesis.
  • Saying "the results are due to chance" with probability p. This reverses the conditioning. The p-value gives the probability of extreme data given a chance-only world, not the probability of a chance-only world given the data.
  • Treating "fail to reject" as "accept". A large p-value is compatible with a zero effect, with a small effect the study could not detect, and with a real effect this sample happened to miss. Report the confidence interval to make that ambiguity visible.
  • Treating 0.05 as a natural boundary. Nothing distinguishes 0.049 from 0.051 scientifically. The threshold is a convention, and the ASA explicitly warns against letting it substitute for reasoning.
  • Equating significance with importance. The fictional 0.4 ml example crosses the 5% threshold under its model. Its practical importance remains undetermined without a relevant tolerance or consequence.
  • Choosing the direction after seeing the sign. For a symmetric continuous null distribution, selecting whichever one-sided alpha=0.05 test favors the observed direction rejects in either 5% tail, yielding 10% overall. Other selection schemes have other effects. Predefine the test and disclose any exploratory alternatives.

Recap

  • A null hypothesis specifies a claim or parameter region. It can concern equality, inequality, or a nonzero benchmark. State the null and alternative before inspecting the results.
  • The test statistic summarizes the planned discrepancy. Its null reference distribution, together with the alternative, determines the p-value; not every statistic is a distance measured in SE units.
  • A p-value is not the probability the null is true, not the probability the result is due to chance, and not one minus the probability the alternative is true.
  • Rejecting H0 when it is true is a Type I error, controlled at no more than alpha by a valid level-alpha procedure; failing to reject a false H0 is a Type II error with probability beta, and power equals 1 - beta.
  • Statistical significance means that the prespecified rejection criterion was met. Practical importance also requires estimated magnitude, uncertainty, and the consequences of a decision.

Multiple testing and practical thresholds

If 20 independent tests each have Type I probability 0.05 and all their nulls are true, the probability of at least one rejection is 1-0.95^20=0.6415. The independence assumption is needed for that expression. Bonferroni uses alpha/20 for each test to control the familywise error rate at no more than alpha without requiring independence. Holm is another familywise procedure; false-discovery-rate methods target a different error criterion. [2]

A precise interval entirely within a prespecified negligible-effect region can support practical equivalence under an appropriate equivalence procedure. Therefore the slogan about absence of evidence should not be read as saying that data can never support the absence of an important effect. Ordinary failure to reject an equality null, by itself, does not establish equivalence.

If all nulls are true and twenty tests independently reject with probability 0.05 each, the chance of at least one rejection is 1-0.95^20=0.6415. Independence is required for this product expression.
If all nulls are true and twenty tests independently reject with probability 0.05 each, the chance of at least one rejection is 1-0.95^20=0.6415. Independence is required for this product expression.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What probability is a p-value not?
  2. What does a valid level-alpha procedure control?
Check your reasoning
  1. It is not the posterior probability that H0 is true or the probability that chance caused the result.
  2. Its Type I error probability is at most alpha under the null and relevant assumptions.

Remember: A significant result can be a false positive, and a non-significant result can occur despite an important effect. Neither label determines practical importance.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. American Statistical Association (March 7, 2016), official release on statistical significance and p-values. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Adjust P-Values for Multiple Comparisons. Read the source.
  3. NIST/SEMATECH, e-Handbook, 1.3.5.2: Confidence Limits for the Mean. Read the source.
  4. R Core Team, R-devel 4.6.0 documentation: Normal Distribution. Read the source.
Key terms
Null hypothesis (H0)
The default claim of no effect or no difference, stated with equality.
Alternative hypothesis (Ha)
The claim of an effect or difference that we test the data against.
Test statistic
A standardized measure of how far the data is from the null prediction.
P-value
The probability of a result at least as extreme as observed, assuming H0 is true.
Significance level (alpha)
The threshold, often 0.05, for rejecting H0.
Type I error
Rejecting a null hypothesis that is actually true.
Type II error
Failing to reject a null hypothesis that is actually false.
Power
The probability a test correctly rejects a false null, equal to 1 minus the Type II error rate.

t-Tests for Means

  • Explain why the t-distribution is used when the population standard deviation is unknown.
  • Compute a one-sample t statistic and its degrees of freedom.
  • Distinguish one-sample, two-sample, and paired t-tests.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

In real studies we almost never know the population standard deviation; if we do not even know the mean we are testing, we surely do not know its spread. We estimate the spread with the sample standard deviation s, and that extra layer of estimation means the z-distribution is no longer exactly right. The fix, one of the most practical tools in statistics, is the t-distribution.

The anchor is the Ridgeway typing course, which claims to raise a standardised typing score whose long-run benchmark is 50 points. A sample of 25 graduates produces a mean of 52 points with a sample standard deviation of 8 points. Nobody knows the population standard deviation of typing scores, which is exactly the situation this lesson exists to handle, and every calculation below refers to those figures.

Key idea: Replacing an unknown population standard deviation with a sample estimate introduces additional uncertainty, and the t-distribution is the reference curve that accounts for it honestly.

In plain terms

Under the iid normal model, replacing the known population SD with the sample SD changes the reference distribution for the standardized mean. The numerator uses the sample mean and the denominator estimates its uncertainty. Their joint distribution yields a t statistic with n-1 degrees of freedom. This reference has heavier tails than the standard normal at finite degrees of freedom and approaches it as the degrees of freedom increase. The hypothesis-testing logic still applies, but the model conditions must be checked.

The t-distribution

The t distribution is symmetric with heavier tails than a standard normal distribution at finite degrees of freedom. For iid normal observations, estimating sigma by s makes (x-bar-mu0)/(s/sqrt(n)) follow a t distribution with n-1 degrees of freedom under H0. The denominator is estimated rather than known. This exact result explains why the multiplier is larger than a normal critical value at small n. [2]

The t shape depends on degrees of freedom, n-1 for the one-sample test. As degrees of freedom increase, it approaches the standard normal. There is no cutoff at which they become identical. At df=24 the 97.5th percentile is 2.0639; at df=35 it is 2.0301; the normal value is 1.9600. Use the distribution appropriate to the procedure instead of switching automatically at n=30.

The convergence is easy to see in the two-sided critical values at alpha = 0.05. With 4 degrees of freedom the critical value is about 2.776, with 9 it is about 2.262, with 24 it is about 2.064, with 100 it is about 1.984, and the limiting normal value is 1.960. Each step toward a larger sample pulls the cutoff closer to the familiar 1.96, and the penalty for a very small sample is substantial: a study with five observations needs a test statistic roughly 40 percent larger than a very large study needs, purely to compensate for uncertainty about the spread.

Key idea: Degrees of freedom, equal to n - 1 for a one-sample test, control how heavy the t-distribution's tails are, and heavier tails mean a larger critical value and a more demanding test.

t densities with 4 and 24 degrees of freedom have heavier tails than the standard normal. There is no finite n=30 point at which t becomes identical to normal.
t densities with 4 and 24 degrees of freedom have heavier tails than the standard normal. There is no finite n=30 point at which t becomes identical to normal.

The one-sample t statistic

To test H0: mean = mu0, the test statistic is t = (x-bar - mu0) / (s / square root of n). It has exactly the same form as a z-statistic (observed minus expected, divided by the standard error) but with the sample standard deviation s standing in for the unknown population value. The result is compared against a t-distribution with n - 1 degrees of freedom rather than the standard normal. Everything you learned about hypotheses, p-values, and the reject/fail-to-reject decision carries over unchanged; only the reference distribution swaps.

Worked example

For this fictional benchmark calculation, assume iid normally distributed post-course scores with unknown positive variance. The benchmark is a fixed comparison value; this model does not establish an effect of attending the course.

A training program claims to change a mean score from 50. A sample of n = 25 participants has x-bar = 52 and s = 8. Test H0: mean = 50 against Ha: mean is not equal to 50 at alpha = 0.05.

  • Standard error = s / square root of n = 8 / 5 = 1.6.
  • Test statistic = t = (52 - 50) / 1.6 = 2 / 1.6 = 1.25.
  • Degrees of freedom = n - 1 = 24.

For a two-sided test with 24 degrees of freedom at alpha=0.05, the critical t-value is about 2.064. The observed absolute statistic 1.25 is smaller, so we fail to reject H0. Under the stated model, the data do not reject a population mean of 50 at this threshold. This is not proof of no difference, and a comparison with a benchmark alone does not identify a causal course effect.

Using the same critical value, the 95% mean interval is 52 +/- 2.064 x 1.6, approximately (48.7,55.3). It includes the benchmark 50 and values 5 points above that benchmark. If a 5-point difference were prespecified as practically important, the interval would leave that possibility unresolved. Report that uncertainty without assigning a consequence that the example has not specified.

Key idea: The two-sided t test at alpha and the corresponding equal-tailed 100(1-alpha)% t interval use the same estimate, SE, model, and critical value. Rejection corresponds to excluding the null value, with a consistent boundary convention. Different interval or test constructions need not agree.

Three flavors of t-test

The same t machinery adapts to three common study designs, and choosing correctly among them is the main practical skill:

  • One-sample t-test: compares one sample mean to a fixed benchmark value (as above). Use it when you have one group and a target number.
  • Independent two-sample t procedure: compares means from groups that are independent under the design and model. Welch's method estimates their variances separately. Different people do not by themselves establish independence, because matching, shared clusters, or other dependence may remain.
  • Paired t-test: compares two measurements on the same individuals, such as each person's before-and-after score; you compute each person's difference and test whether the mean difference is zero. Use it when the same subjects are measured twice, or when subjects are naturally matched.

Worked example: a paired test on five typists. Suppose Ridgeway records each of five students before and after the course. The before scores are 40, 55, 62, 48, and 70, and the after scores are 44, 58, 67, 51, and 75. Work with the differences, taking after minus before: 4, 3, 5, 3, 5. Their sum is 4 + 3 + 5 + 3 + 5 = 20, so the mean difference is 20 / 5 = 4 points. The deviations from that mean are 0, -1, 1, -1, 1, whose squares are 0, 1, 1, 1, 1 and sum to 4, so the sample variance of the differences is 4 / (5 - 1) = 1 and the standard deviation is 1 point. The standard error is 1 / sqrt(5) = 0.447, giving t = (4 - 0) / 0.447 = 8.94 on 4 degrees of freedom. Under an iid normal model for the differences, 8.94 exceeds the two-sided 5% cutoff 2.776. This rejects zero mean change under that model; it does not show that the course caused the change.

The raw before scores range from 40 to 70, while the paired changes range from 3 to 5. In this constructed dataset, each pair's baseline cancels when its difference is computed. Other sources of within-pair variability remain, and pairing does not always reduce uncertainty. The analysis should preserve the dependence created by measuring the same person twice.

Key idea: The paired test analyses one column of differences rather than two columns of scores, which is why its degrees of freedom equal the number of pairs minus one rather than the total number of measurements minus two.

Why pairing matters

Paired analysis uses within-unit differences. Positive correlation between paired measurements can reduce the variance of a difference, since Var(A-B)=Var(A)+Var(B)-2Cov(A,B). This can improve power, but improvement is not guaranteed for every pairing or design. Preserve genuine pair identifiers. A before-and-after change alone does not distinguish a treatment effect from time trends or other changes. [4]

The observed mean change is 4 points. An independent-sample calculation would ignore the paired design and use a different variance calculation. Choose a method that accounts for the actual dependence, such as a paired t procedure when its conditions hold. A more elaborate repeated-measures model can also be appropriate; the smallest available p-value is not a selection rule.

Conditions the t-test relies on

For an exact one-sample t test, observations are independent draws from a normal population with positive variance. In a paired test, apply that condition to differences, with different pairs independent. Welch's two-sample procedure uses independent groups and estimates their variances separately; its degrees of freedom give an approximation. Large-sample robustness depends on the underlying distributions and sampling design. A normal-looking histogram of means is not a complete verification of the t statistic's reference distribution. Methods for dependent or clustered data exist, but they are different procedures. [3]

Key idea: The basic t procedures assume a specified sampling structure. Robustness to nonnormality depends on the distribution and sample sizes. Clustering, serial dependence, or selection problems require methods and assumptions suited to those features; a large n alone does not validate the ordinary formula.

Common misconceptions

  • Using z when sigma is unknown. If the spread came from the sample, use t and n - 1 degrees of freedom. With 24 degrees of freedom the critical value is 2.064 rather than 1.96, and using the smaller value overstates significance.
  • Choosing the test to get a smaller p-value. Preserve known pairing, clustering, and other dependence. Separate labels do not prove that groups are independent. Specify a suitable method before examining which analysis gives the preferred result.
  • Getting the degrees of freedom wrong for paired data. Five students measured twice give five differences and 4 degrees of freedom, not 10 observations and 8 degrees of freedom.
  • Reading a non-significant t-test as proof of no effect. The Ridgeway interval from 48.7 to 55.3 shows the study is compatible with no change and with a useful gain, which is a statement about insufficient precision rather than about absence of effect.
  • Ignoring the conditions. A t-test on badly skewed data from a small sample, or on observations that are not independent, produces a p-value that looks respectable and means very little.

Recap

  • The t-distribution replaces the normal whenever the population standard deviation is estimated from the sample, and its heavier tails reflect that extra uncertainty.
  • Degrees of freedom equal n - 1 for a one-sample test, and larger degrees of freedom pull the critical value down toward the normal value of 1.96.
  • The one-sample statistic is t = (x-bar - mu0) divided by s / sqrt(n), and every step of hypothesis-testing logic carries over unchanged from the z procedure.
  • One-sample tests compare a mean to a benchmark, independent-samples tests compare two separate groups, and paired tests analyse the differences within matched units.
  • Pairing makes within-unit differences the observations. Its precision depends on covariance and design. Use a method that accounts for the actual dependence, regardless of which calculation has the smaller p-value.

Worked example: Welch two-sample comparison

For two fictional independent groups, let n1=20, mean1=12, s1=4 and n2=25, mean2=9, s2=5. Estimate the mean difference as 3. The estimated SE is sqrt(4^2/20+5^2/25)=sqrt(1.8)=1.34164, giving t=3/1.34164=2.23607. The Welch degrees of freedom are (0.8+1)^2 / (0.8^2/19+1^2/24)=42.9988. [4]

The two-sided p-value is about 0.0306 and the 95% interval is about (0.2943,5.7057). Both concern population mean1 minus mean2 under the stated sampling model. In R use t.test(group1,group2,var.equal=FALSE). Reversing the groups changes the sign of the difference and interval, but not the two-sided p-value. Report which subtraction you used, and do not interpret an observational group difference as a treatment effect without a causal design. [1]

For n1=20, mean1=12, s1=4 and n2=25, mean2=9, s2=5, the estimated difference is 3. Welch SE is 1.34164 and the 95% interval is 0.2943 to 5.7057.
For n1=20, mean1=12, s1=4 and n2=25, mean2=9, s2=5, the estimated difference is 3. Welch SE is 1.34164 and the 95% interval is 0.2943 to 5.7057.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What data does a paired t test analyze?
  2. Does pairing always improve power?
Check your reasoning
  1. One difference per matched pair, with independence between pairs and appropriate assumptions for differences.
  2. No. Its effect depends on the covariance and design; positive within-pair correlation often helps.

Remember: The t and normal distributions are not identical at n=30. Exact one-sample t inference needs the normal iid model, not just a normal-looking mean histogram.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. R Core Team, R-devel 4.6.0 documentation: Student t Test. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Student t Distribution. Read the source.
  3. NIST/SEMATECH, e-Handbook, 1.3.5.2: Confidence Limits for the Mean. Read the source.
  4. Penn State STAT 500, Lesson 7: Comparing Two Population Parameters. Read the source.
Key terms
t-distribution
A bell-shaped distribution with heavier tails than the normal, used when the standard deviation is estimated.
Degrees of freedom
A parameter setting the t-distribution's shape; n minus 1 for a one-sample test.
One-sample t-test
A test comparing a single sample mean to a specified value.
Two-sample t-test
A test comparing the means of two independent groups.
Paired t-test
A test on the mean difference of two measurements taken on the same individuals.
Sample standard deviation (s)
The estimate of the population standard deviation used in a t statistic.
Welch's t-test
A two-sample t-test that allows the two groups to have unequal variances.
Effect size
A measure such as Cohen's d of how large a difference is, separate from its statistical significance.

Confidence Intervals and Tests for Proportions

  • Distinguish a population proportion, sample proportion, and binomial count.
  • Calculate and interpret a Wilson interval and a one-proportion score test.
  • Compare two independent proportions and explain approximation and design limits.

Many questions concern a yes-or-no outcome: the proportion of items meeting a specification, respondents choosing an option, or accounts completing a task. A sample proportion estimates a population proportion, but its uncertainty depends on the denominator and the sampling process. All numerical examples here are fictional teaching data.

Define success and the denominator

Let X count successes among n independent trials with common success probability p. Under the binomial model, p-hat=X/n, with mean p and standard deviation sqrt(p(1-p)/n). Here p is the parameter and p-hat is the observed estimate. Success is a coding label, not a value judgment. Define it before counting.

If 60 of 100 observed units succeed, p-hat=0.60. The same 60% based on 6 of 10 units carries more sampling uncertainty. Repeated observations from one unit, clustered respondents, weighted survey data, or trials with changing probabilities are not automatically binomial. The formulas in this lesson require independent observations with the intended common-p interpretation.

Why a simple Wald interval can fail

A familiar interval is p-hat +/- 1.96 sqrt(p-hat(1-p-hat)/n). This is a Wald approximation. It can perform poorly, especially near 0 or 1 and at small n. If no successes are observed, its estimated SE is zero and it returns [0,0], which wrongly conveys complete precision about an unknown population proportion.

Increasing n can help in suitable circumstances, but truncating a negative endpoint to zero does not repair the procedure's coverage. The Wilson interval provides a more useful default introductory calculation. It is still a frequentist interval under the binomial model, not a guarantee that a biased or dependent sampling process has been handled.

Wilson 95% intervals are shown for every possible count in five binomial trials. Unlike the plug-in Wald interval, they do not collapse to zero width at zero or five successes.
Wilson 95% intervals are shown for every possible count in five binomial trials. Unlike the plug-in Wald interval, they do not collapse to zero width at zero or five successes.

Worked example: Wilson interval

For a two-sided confidence level with normal critical value z, define d=1+z^2/n. The Wilson center is (p-hat+z^2/(2n))/d, and its half-width is z sqrt(p-hat(1-p-hat)/n+z^2/(4n^2))/d. Add and subtract the half-width from that center. The interval is not generally centered on p-hat. [1]

With X=60, n=100, and z=1.959964, d is about 1.0384146. The center is about 0.5963 and the half-width about 0.0943. The 95% Wilson interval is approximately (0.5020,0.6906). Report the estimate 0.60, the interval, the denominator 100, and the method name.

The confidence level describes the repeated-sampling procedure under the model. It does not mean that 95% of individuals have success probabilities between the endpoints, or that an observed fixed interval has a frequentist 95% posterior probability. A useful contextual statement is that the binomial-model interval for the target success proportion is about 50.2% to 69.1%.

With 60 successes in 100 iid binomial trials, the 95% Wilson interval is 0.5020 to 0.6906. The uncorrected two-sided score test against p0=0.5 gives z=2 and p=0.04550.
With 60 successes in 100 iid binomial trials, the 95% Wilson interval is 0.5020 to 0.6906. The uncorrected two-sided score test against p0=0.5 gives z=2 and p=0.04550.

Test a specified population proportion

For H0:p=p0, the score z statistic uses the null standard error: z=(p-hat-p0)/sqrt(p0(1-p0)/n). Do not substitute p-hat into this denominator and call it the same score test. With p0=0.50 and p-hat=0.60 from n=100, the null SE is 0.05 and z=2. [2]

A two-sided normal approximation gives p-value=2P(Z>=2)=0.04550. At a prespecified alpha of 0.05, reject this null under the approximation and model. The conclusion concerns evidence of a difference from 0.50, not a 95.45% probability that the alternative is true or proof of a practically important improvement.

Check expected successes np0 and failures n(1-p0) for a normal approximation. Here both are 50. A practical screen of at least ten each is useful, but no single threshold guarantees accurate approximation for every tail or testing problem. When the model is binomial, an exact binomial calculation is available.

Exact methods and software choices

In R, prop.test(60,100,p=0.5,correct=FALSE) reproduces the uncorrected score-test calculation and supplies its interval. The reported test statistic is z squared, here 4, compared with chi-square on one degree of freedom. R's default continuity correction changes the result, so include the option when matching hand arithmetic. [2]

binom.test(60,100,p=0.5) uses an exact binomial test and a Clopper-Pearson interval. Discrete-data tests can give different p-values and intervals from continuous approximations. Exact here means based on the specified discrete distribution, not free of assumptions or guaranteed to be scientifically valid. Its interval has coverage at least the nominal level under the binomial model and can be conservative. [3]

For 0 successes out of 5, a two-sided 95% Clopper-Pearson interval extends from 0 to about 0.5218. Five observed failures plainly do not establish p=0. If all observed outcomes are successes, the analogous issue occurs near p=1. Keep the denominator visible whenever describing a rate.

Compare two independent proportions

Suppose group A has 60 successes among 100 units and group B has 45 among 100, with independent groups and binomial observations within each. The estimated difference p-hat_A-p-hat_B=0.15 is 15 percentage points. The relative increase compared with B is 0.15/0.45, about 33.3%; do not confuse that relative percentage with the absolute difference.

For a large-sample Wald interval for the difference, use the unpooled estimated SE sqrt(0.60(0.40)/100+0.45(0.55)/100)=0.06982. Multiplying by 1.96 gives a margin about 0.13685, so the interval is approximately (0.0132,0.2868). This calculation illustrates the large-sample approximation; it can perform poorly for sparse or extreme proportions, where better methods should be considered. [4]

To test equality pA=pB with the usual two-sided pooled score test, estimate the common null probability as (60+45)/(100+100)=0.525. The pooled null SE is sqrt(0.525(0.475)(1/100+1/100)). The resulting z is about 2.124 and the two-sided p-value about 0.0337. Interval and null-test standard errors answer different questions, so their denominators need not match.

Dependence, design, and communication

Before-and-after binary measurements on the same people are paired, not two independent binomial samples. A repeated cross-section of different people is a different design again. Clustered or survey-weighted data also need an appropriate analysis. The number of rows in a spreadsheet does not establish independence.

Present the numerator, denominator, estimate, interval method, test specification if used, and sampling scope. A population survey inference and a randomized experiment inference require different justifications. An observed difference in completion rates does not automatically identify what would happen if a policy changed.

Finally, separate a decision threshold from a statistical threshold. If a project requires at least a 10-percentage-point benefit, an interval ranging from 1.3 to 28.7 percentage points does not establish that the requirement is met, even though the corresponding equality test is significant. A precise question produces a more useful conclusion than the label significant.

Recap

Count units correctly, justify the probability model, name the interval, use the null proportion for a score test, and preserve the distinction between absolute and relative effects. Report uncertainty and practical requirements together.

Common misconceptions

A continuity-corrected calculation differs from the uncorrected score test. Paired binary outcomes do not form two independent samples.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. Which proportion belongs in a score-test SE?
  2. What changes between absolute and relative differences?
Check your reasoning
  1. The null value p0, not automatically the observed p-hat.
  2. An absolute difference subtracts rates; a relative difference divides that difference by the reference rate.

Remember: A continuity-corrected calculation differs from the uncorrected score test. Paired binary outcomes do not form two independent samples.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 7.2.4.1: Confidence Intervals for a Proportion. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Test of Equal or Given Proportions. Read the source.
  3. R Core Team, R-devel 4.6.0 documentation: Exact Binomial Test. Read the source.
  4. Penn State STAT 500, Lesson 7: Comparing Two Population Parameters. Read the source.
Key terms
Population proportion
The success fraction or probability targeted by an analysis.
Wilson interval
A binomial proportion interval obtained by inverting the score test.
Wald interval
An estimate plus or minus a normal critical value times an estimated SE.
Score test
A test whose variance here is evaluated under the null proportion.
Clopper-Pearson interval
A conservative exact binomial confidence interval.
Percentage point
One unit of absolute difference between percentages.
Pooled proportion
The combined successes divided by combined trials under an equality null.
Continuity correction
An adjustment for approximating a discrete statistic with a continuous reference.

Module 5: Relationships Between Variables

Analyze relationships, categorical counts, and multiple group means; finish with a reproducible analysis and model interpretation.

Correlation and Linear Regression

  • Interpret the correlation coefficient r and its sign and strength.
  • Find the least-squares regression line and use it to predict.
  • Explain the meaning of the slope, intercept, and r-squared, and why correlation is not causation.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

So far every technique has concerned a single variable. To study how two quantitative variables move together, such as height and weight or advertising and sales, we need new tools. We start with a scatterplot, where each point is one individual's (x, y) pair, and then summarize the pattern with a number (correlation) and a line (regression).

The anchor is the Bridgeway Tutoring log, which records for five students the number of hours each spent studying and the score each earned on a ten-point quiz. The hours are 1, 2, 3, 4, and 5, and the corresponding scores are 2, 4, 5, 4, and 5. Five points is a deliberately tiny dataset, chosen so that every sum, every coefficient, and every residual can be computed and checked by hand rather than accepted on faith from software.

Key idea: Correlation summarises the strength and direction of a straight-line relationship with a single number, while regression supplies the line itself and therefore the ability to predict.

In plain terms

Two quantitative variables measured on the same individuals can be plotted as a cloud of points, and two summaries describe that cloud. The first is a number between -1 and +1 that reports how tightly the points hug a straight line and whether that line rises or falls. Values close to either extreme mean the points sit almost exactly on a line, and values close to zero mean no straight-line pattern is present, although a strong curved pattern may still be hiding there. The second summary is the line that fits best, defined as the line making the total of the squared vertical misses as small as possible. That line has a slope, which says how much the outcome changes per one-unit increase in the predictor, and an intercept, which says what the line predicts when the predictor equals zero. Both summaries describe association only, and neither one, by itself, can establish that changing the first variable would change the second.

The correlation coefficient

Pearson's correlation coefficient r describes linear association for paired finite numerical observations when both variables have positive sample variance. It is undefined if either variable is constant. When defined, -1<=r<=1. A positive sign indicates upward linear association, a negative sign downward association, and a value near zero does not rule out a strong nonlinear relationship.

Correlation is unchanged when the variables are interchanged, a constant is added, or either variable is multiplied by a positive constant. Multiplying just one variable by a negative constant reverses its sign. These are mathematical properties, not evidence that a correlation is substantively meaningful. Plot the data and consider outliers, range restriction, and subgroups.

Verbal labels such as weak or strong depend on the measurement, scientific question, sampling range, and intended decision. A correlation value does not establish measurement agreement or calibration. Report its numerical value with a scatterplot, uncertainty where appropriate, and substantive context rather than applying a universal importance threshold.

Key idea: Correlation measures linear association, requires variation in both variables, and is invariant to positive changes of units. Negative rescaling of one variable reverses its sign.

Least-squares regression

The regression line is the single straight line that best fits the points by making the sum of squared vertical distances (the residuals) as small as possible, which is why it is called the least-squares line. We write it y-hat = b0 + b1 x, where b1 is the slope and b0 is the intercept, and the hat on y signals a predicted value rather than an observed one.

The slope tells how much y-hat changes for each one-unit increase in x, and it carries the units of y per unit of x (for example, dollars of sales per dollar of advertising). The intercept is the predicted y when x = 0, whose interpretation at x = 0 needs justification if that value is outside the observed range.

A residual is observed y minus fitted y. Unweighted ordinary least squares chooses coefficients to minimize the sum of squared residuals. When the fitted model includes an intercept, its residuals sum to zero, up to numerical rounding. Without an intercept, this identity need not hold. Residual plots are also used to investigate systematic patterns the model missed. [1]

Key idea: Ordinary least squares minimizes squared deviations in the chosen response direction. Reversing predictor and response generally gives a different fitted relationship, while leaving Pearson correlation unchanged. A perfect nonhorizontal straight-line dataset is a special case where the two fitted geometric lines coincide.

Worked example

Five points: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5. The needed sums are: sum x = 15, sum y = 20, sum xy = 66, sum x-squared = 55, with n = 5, so mean x = 3 and mean y = 4.

The slope is b1 = (n(sum xy) - (sum x)(sum y)) / (n(sum x-squared) - (sum x)^2) = (5(66) - 15(20)) / (5(55) - 15^2) = (330 - 300) / (275 - 225) = 30 / 50 = 0.6.

The intercept is b0 = mean y - b1(mean x) = 4 - 0.6(3) = 4 - 1.8 = 2.2. So the regression line is y-hat = 2.2 + 0.6 x. Notice the line always passes through the point of averages (mean x, mean y) = (3, 4), a fact you can use to check your work: 2.2 + 0.6(3) = 4.

To predict y when x = 6: y-hat = 2.2 + 0.6(6) = 2.2 + 3.6 = 5.8. For this data the correlation works out to r = 0.775, a moderately strong positive linear relationship.

Worked example: computing r from deviations. The correlation can be built from the same deviations used for the mean. With mean x = 3 and mean y = 4, the x-deviations are -2, -1, 0, 1, 2 and the y-deviations are -2, 0, 1, 0, 1. Multiply them pairwise to obtain 4, 0, 0, 0, 2, which sum to 6. Square the x-deviations to obtain 4, 1, 0, 1, 4, summing to 10, and square the y-deviations to obtain 4, 0, 1, 0, 1, summing to 6. Then r = 6 / sqrt(10 x 6) = 6 / sqrt(60) = 6 / 7.746 = 0.775. The slope follows immediately as 6 / 10 = 0.6, matching the earlier calculation and confirming both.

Worked example: residuals and the zero-sum check. Using y-hat = 2.2 + 0.6x, the five predictions are 2.8, 3.4, 4.0, 4.6, and 5.2. Subtracting each from its observed score gives residuals of 2 - 2.8 = -0.8, 4 - 3.4 = 0.6, 5 - 4.0 = 1.0, 4 - 4.6 = -0.6, and 5 - 5.2 = -0.2. Their sum is -0.8 + 0.6 + 1.0 - 0.6 - 0.2 = 0, exactly as least squares guarantees. Squaring and adding gives 0.64 + 0.36 + 1.00 + 0.36 + 0.04 = 2.40, and since the total squared variation in y was 6, the fraction left unexplained is 2.40 / 6 = 0.40, so the fraction explained is 1 - 0.40 = 0.60. That is exactly r-squared, computed by a completely independent route.

Key idea: For unweighted simple least squares with an intercept, residuals sum to zero and R-squared equals r squared. State these conditions before using either identity.

For x=1,2,3,4,5 and y=2,4,5,4,5, the fitted line is 2.2+0.6x. Residuals are -0.8,0.6,1,-0.6,-0.2, summing to zero because the OLS model includes an intercept.
For x=1,2,3,4,5 and y=2,4,5,4,5, the fitted line is 2.2+0.6x. Residuals are -0.8,0.6,1,-0.6,-0.2, summing to zero because the OLS model includes an intercept.

R-squared and the danger of extrapolation

For this simple OLS model with an intercept, R-squared=1-SSE/SST=r^2=0.60. Sixty percent of the observed squared variation about the sample mean is accounted for by the fitted linear values. The remaining 40% is residual variation. Its causes cannot be identified from R-squared. A high R-squared does not establish causality, correct model specification, or accurate predictions on new data. [2]

One serious hazard is extrapolation: using the line to predict far outside the range of the observed x-values. Our data covers x from 1 to 5; predicting at x = 6 is a mild stretch, but predicting at x = 50 would be reckless, because nothing guarantees the linear pattern continues where we have no data.

Key idea: R-squared reports the proportion of variation in y accounted for by the linear relationship with x, and a high value indicates a tight fit rather than a correct causal model.

Correlation is not causation

An association can arise through a causal effect, reverse direction, confounding, selection, or coincidence. In a fictional tutoring dataset, motivation and prior knowledge might affect both study time and score. A regression coefficient by itself does not isolate the effect of assigning an extra hour of study.

A randomized experiment can support a causal comparison when assignment, follow-up, adherence, and analysis support the intended question. Causal inference from observational data is also possible under additional design and identification assumptions, but those assumptions cannot be established by a scatterplot or an adjusted coefficient alone. State the actual design and limits of the conclusion. [4]

Common misconceptions

  • Reading a correlation near zero as no relationship. It indicates little measured linear association, not the absence of every relationship. A perfect U-shaped pattern can have r close to zero, which is why the scatterplot must always be inspected before r is trusted.
  • Interpreting the intercept outside the data. The Bridgeway intercept of 2.2 predicts the score for zero hours of study, and no student in the sample studied zero hours, so that number is an extrapolation rather than an observation.
  • Predicting far beyond the observed range. The model was fitted on 1 to 5 hours. Predicting at 6 hours is a mild stretch; predicting at 50 hours would produce a score of 32.2 on a ten-point quiz, which is arithmetically valid and physically impossible.
  • Treating a high r-squared as proof of causation. R-squared measures how tightly the points cluster around the line and says nothing about why they do. A confounded relationship can fit beautifully.
  • Reversing a regression without refitting. Predicting y from x and predicting x from y are different tasks. In general, solving one fitted equation for its predictor does not produce the least-squares fit for the reversed task. The perfect-linear-association case is an exception.

Recap

  • The correlation coefficient r lies between -1 and +1 and measures the strength and direction of a straight-line association between two quantitative variables.
  • The least-squares regression line minimises the sum of squared vertical residuals, and with an included intercept, those residuals sum to zero.
  • The slope reports the predicted change in y per one-unit increase in x, and interpreting the intercept at x = 0 requires extra justification if it lies outside the observed range.
  • For unweighted simple OLS with an intercept and positive variation in both variables, R-squared equals Pearson r squared. It is the fraction of observed squared response variation accounted for by the fitted values, not a causal fraction.
  • Correlation is consistent with direct causation, reverse causation, confounding, and coincidence, so correlation alone does not identify a causal effect.

Diagnostics and two kinds of uncertainty

Plot residuals against fitted values to look for curvature or changing spread, examine their ordering for dependence, and inspect unusual or influential cases. A normal quantile plot assesses the normal-error assumption used in small-sample t and F inference. Fitting a least-squares line does not itself require normal residuals; exact conventional inference adds a normal, independent, constant-variance error model and a correctly specified conditional mean. [3]

A confidence interval for the mean response at a given x describes uncertainty in the average response. A prediction interval for a new individual adds individual error and is usually wider under the same model. In R, predict(fit,newdata,interval="confidence") and predict(fit,newdata,interval="prediction") request different intervals. Neither protects against unsupported extrapolation or a different future population. [3]

Under the conventional independent normal constant-variance linear error model, a new-individual prediction interval is wider than the mean-response interval. These illustrative intervals do not establish model validity or permit extrapolation.
Under the conventional independent normal constant-variance linear error model, a new-individual prediction interval is wider than the mean-response interval. These illustrative intervals do not establish model validity or permit extrapolation.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. When is Pearson r undefined?
  2. When do simple OLS residuals sum to zero?
Check your reasoning
  1. When either variable has zero variance, or the required numerical moments are not defined.
  2. For unweighted least squares with an intercept, up to numerical rounding.

Remember: Correlation is not an identified causal effect. Negative rescaling of one variable reverses r; positive unit changes leave it unchanged.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 4.4.3.1: Least Squares. Read the source.
  2. R Core Team, R-devel 4.6.0 documentation: Fitting Linear Models. Read the source.
  3. R Core Team, R-devel 4.6.0 documentation: Prediction from Linear Models. Read the source.
  4. Hernan and Robins, Causal Inference: What If, author-hosted August 19, 2026 version. Read the source.
Key terms
Scatterplot
A graph plotting paired values of two quantitative variables as points.
Correlation coefficient (r)
A unitless measure of linear association, defined when both variables have positive variance.
Regression line
The least-squares line y-hat = b0 + b1 x that best predicts y from x.
Slope
The change in predicted y for each one-unit increase in x.
R-squared
For ordinary least squares with an intercept, one minus residual squared variation divided by total squared variation.
Lurking variable
A hidden variable that can create a correlation without causation.
Extrapolation
Predicting with a model outside the range of the observed data, which is unreliable.
Residual
The vertical distance between an observed y and the value predicted by the line.

The Chi-Square Test

  • Describe when a chi-square test is used and what data it needs.
  • Compute expected counts and the chi-square statistic.
  • Interpret the result and its degrees of freedom for both goodness-of-fit and independence tests.

Example provenance: Named clinics, schools, businesses, and their numerical data in this lesson are fictional teaching examples. They are not reports of a research study.

Correlation and regression handle two quantitative variables. When the variables are instead categorical, so our data is counts in categories rather than measured numbers, we turn to the chi-square test. Its core idea is beautifully simple: compare the counts we actually observed against the counts we would expect if a stated model were true, and evaluate how unusual the discrepancy is under the specified null sampling model.

Two anchors run through this lesson, both drawn from the Elmwood Community Center. The board-game club suspects that one of its dice is loaded and has rolled it 60 times to find out. The clinic that shares the building has run a small trial in which 100 patients received either a treatment or a control condition and were recorded as improved or not improved. The first situation calls for a goodness-of-fit test and the second for a test of independence, and both use exactly the same statistic.

Key idea: A chi-square test compares counts you observed against counts a stated model predicts, and asks whether the discrepancy is larger than random variation would comfortably produce.

In plain terms

Start with the expected counts under a specified null model. Equal face probabilities give equal expected die counts; equal improvement probabilities give expected trial counts consistent with independence. Observed counts need not equal expectations even under the null. For each positive expected count E, calculate (O-E)^2/E and sum the contributions. Larger discrepancies give larger statistics. Compare the result with the appropriate reference distribution and state its conditions.

Two common chi-square tests

  • Goodness-of-fit test: checks whether one categorical variable follows a claimed distribution. Example: is a six-sided die fair, meaning each face equally likely?
  • Test of independence: checks whether two categorical variables are associated, using a two-way table of counts. Example: is recovery (improved or not) associated with treatment group?

The chi-square statistic

Both tests use the same statistic: chi-square = sum of (observed - expected)^2 / expected, added over every category or cell. Each term compares one observed count O to its expected count E: the squared gap (O - E)^2 makes every contribution nonnegative and magnifies large discrepancies, and dividing by E scales the gap relative to how big a count we expected there (a gap of 5 is trivial when we expected 1000 but alarming when we expected 3).

Large chi-square values mean the observed counts sit far from what the model predicts, which is evidence against the null hypothesis (that the claimed distribution or independence holds). The chi-square distribution used to judge the statistic is right-skewed and, like the t, its exact shape depends on the degrees of freedom.

The computed Pearson statistic is a nonnegative number. Its approximate null reference distribution, not that single number, is right-skewed. Large values provide evidence of lack of fit. For k fully specified multinomial categories, df=k-1. If parameters are estimated from the same data, further degrees of freedom may be lost under regular conditions. For an ordinary r-by-c independence table with positive margins, df=(r-1)(c-1). [2]

Key idea: Dividing each squared discrepancy by its expected count is what makes the contributions comparable, since the same absolute gap means very different things at different expected frequencies.

Worked example: goodness of fit

A die is rolled independently 60 times with stable face probabilities. If it is fair, each face is expected 60 / 6 = 10 times. Observed counts are 8, 12, 9, 11, 10, 10 for faces 1 through 6. The contributions to chi-square are:

FaceObservedExpected(O - E)^2 / E
18100.4
212100.4
39100.1
411100.1
510100.0
610100.0

Adding the contributions gives 0.4+0.4+0.1+0.1+0+0=1.0. With six fully specified equal probabilities, the reference degrees of freedom are 6-1=5. The critical value at alpha=0.05 is about 11.07. Since 1.0 is below that cutoff, we fail to reject the fair-die null under the stated sampling model. This does not establish that the die is fair. [3]

Word that conclusion with care. The club has not shown the die is fair; it has failed to find evidence that the die is unfair, and with only 60 rolls a mild bias could easily hide. Contrast that outcome with a genuinely suspicious die. Suppose a second die rolled 60 times produces counts of 4, 6, 8, 10, 14, and 18 across the six faces, again totalling 60 against an expectation of 10 each. The contributions are (4-10)^2/10 = 3.6, (6-10)^2/10 = 1.6, (8-10)^2/10 = 0.4, (10-10)^2/10 = 0, (14-10)^2/10 = 1.6, and (18-10)^2/10 = 6.4. Adding them gives 3.6 + 1.6 + 0.4 + 0 + 1.6 + 6.4 = 13.6, which exceeds the critical value of 11.07 on 5 degrees of freedom, so this time the club rejects fairness. Notice that the largest single contribution, 6.4, comes from the face that appeared 18 times, which points straight at where the model failed.

Key idea: Individual cell contributions identify which categories drive a significant result, which turns a single yes-or-no verdict into a usable diagnosis.

The chi-square reference distribution with df=5 is right-skewed. Computed die-test statistics 1.0 and 13.6 are individual numbers on that reference, not distributions with their own skew.
The chi-square reference distribution with df=5 is right-skewed. Computed die-test statistics 1.0 and 13.6 are individual numbers on that reference, not distributions with their own skew.

Test of independence and expected counts

For a two-way table, the expected count in any cell, under the null of independence, is (row total x column total) / grand total. This formula is just the multiplication rule for independent events applied to counts. Consider 100 patients in a 2-by-2 table (treatment versus control, improved versus not):

ImprovedNot improvedRow total
Treatment301040
Control204060
Col total5050100

The expected count for the treatment-improved cell is (40 x 50) / 100 = 20. Working out all four cells (the expected counts are 20, 20, 30, 30) and summing (O - E)^2 / E gives chi-square = 16.67. The degrees of freedom for an independence test are (rows - 1)(columns - 1) = (2 - 1)(2 - 1) = 1.

The uncorrected Pearson statistic is 16.6667 with df=1, giving p approximately 0.0000446 under the null and sampling assumptions. The fictional observed rates are 30/40=75% and 20/60=33.33%, a difference of 41.67 percentage points. These data are strongly incompatible with the independence model. Random variation remains possible; a small p-value does not logically rule it out or establish causation.

Worked example: every cell of the Elmwood trial. Set the four expected counts out explicitly, each one computed as row total times column total divided by 100. Treatment-improved is (40 x 50) / 100 = 20, treatment-not-improved is (40 x 50) / 100 = 20, control-improved is (60 x 50) / 100 = 30, and control-not-improved is (60 x 50) / 100 = 30. Check the bookkeeping: the expected counts reproduce the original row totals of 40 and 60 and the column totals of 50 and 50, which they must. Now compute the four contributions. Treatment-improved gives (30 - 20)^2 / 20 = 100 / 20 = 5.00, treatment-not-improved gives (10 - 20)^2 / 20 = 5.00, control-improved gives (20 - 30)^2 / 30 = 100 / 30 = 3.33, and control-not-improved gives (40 - 30)^2 / 30 = 3.33. The total is 5.00 + 5.00 + 3.33 + 3.33 = 16.67 on 1 degree of freedom, far beyond the critical value of 3.84.

Key idea: Expected counts under independence come from the row and column totals alone, and they must reproduce those totals exactly, which is a reliable check on the arithmetic.

Observed cells 30,10,20,40 have expected counts 20,20,30,30 under independence. The uncorrected contributions sum to 16.6667 on one degree of freedom.
Observed cells 30,10,20,40 have expected counts 20,20,30,30 under independence. The uncorrected contributions sum to 16.6667 on one degree of freedom.

Conditions and cautions

The usual Pearson test uses actual counts of independent observational units, with each unit in exactly one cell of the table. Percentages alone may not identify the counts, particularly after rounding. Obtain the original counts and denominators. Weighted survey totals, repeated responses, and clustered observations require methods that reflect their designs. [1]

The chi-square reference is an approximation whose accuracy depends on the table and sampling model. Expected counts of at least 5 in every cell are a common introductory screening rule, not a universal theorem. Sparse expected cells warrant an appropriate exact or simulation-based method; Fisher's exact test is one option for a suitable two-way table. Each alternative has its own sampling assumptions. Rejection provides evidence against the tested null model, without proving association or causation.

The test supplies evidence about a specified null model, not certainty that an association exists. Report the observed rates or an effect measure and uncertainty. Statistical significance does not determine practical importance: even a one-percentage-point difference may matter in some settings and not others. Define the decision context before interpreting size. [4]

Key idea: A small chi-square p-value indicates incompatibility with the tested model under its assumptions. Counts, proportions, effect size, uncertainty, and design are needed to interpret the result.

Common misconceptions

  • Feeding rounded percentages into the formula. Original integer counts and sample sizes are needed. Rounding 20/60 to 33% loses information, so multiplying the rounded rate by 60 does not recover the exact count.
  • Applying a degrees-of-freedom shortcut outside its conditions. For k multinomial categories with fully specified null probabilities, df=k-1. Estimating parameters from the same data can require further adjustment. For the ordinary r-by-c independence table with positive margins, df=(r-1)(c-1).
  • Checking observed counts rather than expected counts against the rule of 5. The condition concerns expected counts. A cell that observed zero events is not automatically a problem if its expected count is comfortably above 5.
  • Reading a non-significant result as proof of independence. The fair-die test failed to reject, which is not the same as demonstrating fairness. Sixty rolls simply cannot detect a mild bias.
  • Concluding causation from association. A small p-value in a table is insufficient for a causal claim. Random assignment can support a causal comparison under a well-executed design; observational causal claims require additional explicit assumptions and evidence.

Recap

  • The chi-square statistic sums (observed minus expected) squared divided by expected across all categories or cells, and it is nonnegative; the approximate chi-square null reference distribution is right-skewed.
  • A goodness-of-fit test compares categorical counts with specified probabilities. With k fully specified multinomial probabilities, its usual chi-square reference has k-1 degrees of freedom. Fitted parameters can change this calculation.
  • A test of independence checks two categorical variables for association, with expected counts equal to row total times column total divided by grand total and degrees of freedom equal to (rows - 1)(columns - 1).
  • Use actual counts and an appropriate sampling model. Assess whether the chi-square approximation is suitable; sparse tables may call for an exact or simulation-based calculation.
  • Rejecting independence provides evidence against the null model, not proof or an automatic causal interpretation, and the percentages in the table are what communicate the size and importance of the effect.

Software settings and effect size

To reproduce the uncorrected table calculation in R, use tab <- matrix(c(30,10,20,40),nrow=2,byrow=TRUE); chisq.test(tab,correct=FALSE). R's default for a 2-by-2 table applies Yates' continuity correction, giving a different statistic. State the setting rather than treating the difference as an arithmetic error. [1]

For this table, Cramer's V=sqrt(chi-square/(n x min(r-1,c-1)))=sqrt(16.6667/100)=0.4082. V measures association magnitude without a sign. The difference in observed improvement rates, 41.67 percentage points, is easier to interpret in this example. Neither quantity identifies a causal effect or its importance by itself. Sparse expected counts may require an exact or simulation-based procedure, and its own sampling assumptions still apply.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What are the units of input to a usual Pearson table test?
  2. Does the observed scalar statistic have a right-skewed shape?
Check your reasoning
  1. Actual categorical counts of appropriately independent units, not arbitrary percentages or averages.
  2. No. The approximate null reference distribution has a shape; a computed statistic is a number.

Remember: A small p-value does not prove association or eliminate chance. Rounded percentages may not reproduce the original integer counts.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. R Core Team, R-devel 4.6.0 documentation: Pearson Chi-Squared Test for Count Data. Read the source.
  2. NIST/SEMATECH, e-Handbook, 1.3.5.15: Chi-Square Goodness-of-Fit Test. Read the source.
  3. NIST/SEMATECH, e-Handbook, 1.3.6.7.4: Critical Values of the Chi-Square Distribution. Read the source.
  4. American Statistical Association (March 7, 2016), official release on statistical significance and p-values. Read the source.
Key terms
Chi-square test
A test comparing observed categorical counts to counts expected under a null model.
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 are associated.
Expected count
The count predicted under the null, found from row and column totals for a two-way table.
Observed count
The actual number of individuals recorded in a category or cell.
Chi-square statistic
The sum over cells of (observed minus expected) squared, divided by expected.
Two-way table
A table of counts cross-classifying individuals by two categorical variables.
Fisher's exact test
An exact alternative used when expected counts are too small for the chi-square approximation.

Comparing Several Means with One-Way ANOVA

  • State the one-way ANOVA null and distinguish it from claims about particular pairs.
  • Compute between-group and within-group sums of squares and the F statistic.
  • Evaluate assumptions, multiplicity, effect size, and alternatives for unequal variances.

When a quantitative response is compared across three or more groups, a sequence of unadjusted t tests can obscure the overall question and increase the chance of at least one false positive. Analysis of variance, or ANOVA, provides a structured comparison of group means through variation between and within groups.

Question, model, and hypotheses

Let there be k independent groups, with group i containing n_i observations and total N. A one-way fixed-effects model represents each observation as its group mean plus an error. The classical F reference assumes independent normal errors with mean zero and the same variance in every group. The factor has k levels, such as three assigned production settings. [2]

The null is mu1=mu2=...=muk. The alternative is that not all group means are equal. It does not say every pair differs, specify which mean is largest, or claim that any difference is practically important. The word one-way refers to one grouping factor, not a one-sided claim that all means increase.

ANOVA can describe differences in observational groups as well as randomized experiments. Causal interpretation depends on the design. If a school chose a different teaching method for each of three pre-existing classes, class characteristics and method may be confounded. A calculation cannot supply random assignment that did not occur.

Partition the variation

The total sum of squares is SST=sum_all (y-grand_mean)^2. The within-group sum of squares is SSW=sum_groups sum_within (y-group_mean)^2. The between-group sum of squares is SSB=sum_groups n_i(group_mean-grand_mean)^2. In this ordinary one-way model with group means, SST=SSB+SSW. [1]

The grand mean is weighted by group sizes. An unweighted mean of group means gives the same result only when group sizes are equal or by coincidence. The n_i factors in SSB recognize that a shift affecting a large group contributes more total squared variation than the same shift affecting a small group.

Divide by the appropriate degrees of freedom to form mean squares: MSB=SSB/(k-1) and MSW=SSW/(N-k). Under the classical null model, both estimate the same error variance. Under an alternative, separated group means tend to make MSB relatively large.

Worked example: three small groups

Use these original synthetic measurements, solely for hand arithmetic: A=4,5,6, B=7,8,9, C=10,11,12. The group means are 5,8,11, and the grand mean is 8. The sample size is N=9 and the number of groups k=3. This deliberately small constructed example is not an actual experiment.

The between-group sum is 3(5-8)^2+3(8-8)^2+3(11-8)^2=27+0+27=54. Within each group, deviations from its mean are -1,0,1, with squared sum 2. Therefore SSW=6. The total sum is 60, which can also be checked by squaring all nine deviations from 8.

SourceSum of squaresdfMean square
Between groups54227
Within groups661
Total608Not used in F ratio

The F statistic is MSB/MSW=27/1=27. It is nonnegative and is compared with an F distribution with numerator df=2 and denominator df=6. Reversing the ratio or the degrees of freedom changes the reference calculation.

Synthetic groups A=4,5,6; B=7,8,9; C=10,11,12 have means 5,8,11 and grand mean 8. SSB=54, SSW=6, and SST=60.
Synthetic groups A=4,5,6; B=7,8,9; C=10,11,12 have means 5,8,11 and grand mean 8. SSB=54, SSW=6, and SST=60.

Interpret F without overclaiming

Under the stipulated independent normal equal-variance model, P(F_(2,6)>=27)=0.001. This is a model-based calculation for the constructed numbers. At a prespecified alpha of 0.05, it rejects the equal-means null. It does not prove that each pair differs or assign probability 0.999 to a causal explanation.

The F statistic compares relative variation. A graph helps connect the result to the data: show individual values and group means, not just bars that conceal within-group variation. With only three values per group, apparent equal spreads and tidy residual patterns provide little evidence about the full error distributions. Checking arithmetic is different from validating assumptions.

If MSW is zero, the ordinary ratio is not a routine finite test statistic. Do not report an infinite value as if it established a scientifically unquestionable effect. Investigate whether the response was rounded, data were duplicated, or the illustrative example lacks the stochastic variation required by the model.

The F(2,6) upper tail beyond 27 has probability 0.001 under the classical null model. A log density scale makes the small tail visible; rejection does not identify every differing pair.
The F(2,6) upper tail beyond 27 has probability 0.001 under the classical null model. A log density scale makes the small tail visible; rejection does not identify every differing pair.

Assumptions and diagnostics

Independence comes principally from how units were sampled or assigned. Repeated measurements of the same unit or clusters violate the simple independent-error formulation. Plot residuals against fitted values and the order of collection. A pattern of increasing spread or temporal drift can reveal a mismatch with the model.

The normality assumption concerns errors within groups, not necessarily the pooled response. Even perfectly normal groups with different means can form a nonnormal pooled distribution. Examine within-group or model residual behavior, while recognizing that a normal probability plot in a tiny sample cannot establish exact normality.

Unequal variances, especially alongside unequal group sizes, can undermine the classical F approximation. Welch's one-way procedure allows unequal variances under its own assumptions. A rank-based test addresses a different distributional comparison and should not automatically be described as a test of means. The choice should follow the question and model, not whichever procedure gives the smallest p-value.

Follow-up comparisons and effect size

After an omnibus test, identifying particular differences requires planned contrasts or appropriately adjusted pairwise comparisons. Three groups have three pairs; ten groups have 45. Repeating a 0.05 test for each pair does not keep the chance of any false positive at 0.05. State the family of comparisons and the error criterion being controlled.

Tukey's procedure is a common simultaneous pairwise method under the classical equal-variance model; Holm adjustment can be applied to a specified family of suitable individual tests. Adjustments do not cure confounding, dependence, or selective reporting. Show estimated differences and intervals as well as adjusted p-values. [5]

For a descriptive measure in this example, eta-squared=SSB/SST=54/60=0.90. This is the fraction of observed total squared variation associated with group differences in the fitted sample model. It is not a probability of success, a causal percentage, or an unbiased population effect estimate. Report differences in the original response units when those are more meaningful.

Reproduce the example in R

Create dat <- data.frame(y=c(4,5,6,7,8,9,10,11,12), group=factor(rep(c("A","B","C"),each=3))). Then fit fit <- aov(y~group,data=dat) and inspect summary(fit). The table should show sums of squares 54 and 6, degrees of freedom 2 and 6, and F=27. [3]

pf(27,2,6,lower.tail=FALSE) returns the reference upper-tail probability. For unequal-variance analysis use oneway.test(y~group,data=dat,var.equal=FALSE); this is a different procedure with potentially different degrees of freedom and p-value. For classical pairwise comparisons, TukeyHSD(fit) states which procedure is being used. [4]

Recap

Identify the factor and response, distinguish omnibus and pairwise questions, partition variation with the correct weights and degrees of freedom, and interpret F under explicit assumptions. The graph, design, effect sizes, and uncertainty remain essential parts of the conclusion.

Common misconceptions

Normality concerns within-group errors, not necessarily the pooled data. An F result does not prove a causal treatment effect.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What does the omnibus alternative say?
  2. Which mean belongs in SSB?
Check your reasoning
  1. Not all group means are equal; it does not identify every differing pair.
  2. The grand mean weighted by group sample sizes.

Remember: Normality concerns within-group errors, not necessarily the pooled data. An F result does not prove a causal treatment effect.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. NIST/SEMATECH, e-Handbook, 3.2.3.1: One-Way ANOVA. Read the source.
  2. NIST/SEMATECH, e-Handbook, 7.4.3.2: One-Way ANOVA Model and Assumptions. Read the source.
  3. R Core Team, R-devel 4.6.0 documentation: Fit an Analysis of Variance Model. Read the source.
  4. R Core Team, R-devel 4.6.0 documentation: Equal Means in a One-Way Layout. Read the source.
  5. R Core Team, R-devel 4.6.0 documentation: Adjust P-Values for Multiple Comparisons. Read the source.
Key terms
One-way ANOVA
A model and test comparing quantitative means across levels of one factor.
Omnibus test
A test of a joint hypothesis, such as equality of all group means.
Between-group sum of squares
Group-size-weighted squared deviations of group means from the grand mean.
Within-group sum of squares
Squared deviations of observations from their own group means.
F statistic
Here the between-group mean square divided by the within-group mean square.
Equal variance assumption
The classical model assumes the same error variance for every group.
Multiple comparisons
A family of comparisons whose combined error rate needs consideration.
Eta-squared
The sample fraction SSB/SST in the ordinary one-way model.

Reproducible Analysis and Multivariable Interpretation

  • Reproduce summaries of a documented dataset while preserving data provenance.
  • Interpret an adjusted group coefficient and recognize a possible interaction.
  • Communicate a complete analysis with diagnostics, uncertainty, and explicit limits.

A complete statistical analysis connects a question, documented data, a defensible method, and a conclusion whose scope matches the evidence. This final lesson combines the course's skills using a real dataset distributed with R. The dataset is used to teach analysis, not to recommend a treatment or to recreate a modern clinical trial.

Read the dataset documentation first

R's ToothGrowth dataset has 60 observations and three variables: len, supp, and dose. Its documentation describes measurements of odontoblast length in guinea pigs given vitamin C at 0.5, 1, or 2 mg/day through orange juice (OJ) or ascorbic acid (VC). It cites Bliss's 1952 book and Crampton's 1947 article as provenance. [1]

The current R help page does not fully document the allocation mechanism or specify a unit for the recorded length values. Do not invent either. Report "recorded length units" and qualify causal conclusions accordingly. A familiar dataset name, published origin, or variable labeled treatment does not by itself establish randomization, independence, or applicability to humans.

The original data values are available in R's official source distribution. For reproduction, record the source URL, retrieval date, software version, and transformations. Preserve the original values. A saved script, source record, and clear output are more informative than a screenshot of a favorable p-value. [2]

Inspect structure and missingness

In R, run data("ToothGrowth",package="datasets"); d <- ToothGrowth; str(d); colSums(is.na(d)); table(d$supp,d$dose). There should be 60 rows, no missing entries in the three supplied variables, and ten observations in each of the six supplement-dose cells. A failed check should prompt investigation rather than silent editing to obtain the expected answer.

R stores dose numerically, but our first comparison treats the three specified levels as separate categories. Create d$dose_group <- factor(d$dose). This choice avoids assuming that the mean response changes linearly with dose. A numeric-dose regression is a different model with a different interpretation, not merely another way of typing the same command.

The absence of missing values in the supplied file does not establish that no data were missing, excluded, or unavailable in the original study. Distinguish what the file shows from what its documentation establishes. Do not treat row order as a verified time or pairing variable without evidence.

Summarize before fitting

Compute aggregate(len~supp+dose_group,data=d,FUN=mean). The cell means, in recorded units, are OJ: 13.23,22.70,26.06 and VC: 7.98,16.77,26.14 at doses 0.5,1,2. Show individual observations in the figure together with these means. Means alone conceal overlap and differences in spread.

At dose 0.5, the observed OJ-minus-VC mean difference is 5.25. At dose 1 it is 5.93, and at dose 2 it is -0.08. The sign and magnitude therefore differ across dose groups in the sample. That pattern motivates examination of an interaction; it is not by itself proof that population effects differ.

A plot of means connected across ordered dose levels is useful as a visual summary, but the connecting segments do not establish a continuous dose-response curve between the observed levels. Preserve the distinction between measured dose settings and unobserved intermediate values.

R ToothGrowth has ten observations per supplement-dose cell. Points show all 60 recorded values; short lines show cell means. The reviewed help page does not specify a length unit or fully document allocation.
R ToothGrowth has ten observations per supplement-dose cell. Points show all 60 recorded values; short lines show cell means. The reviewed help page does not specify a length unit or fully document allocation.

Fit an additive model

Start with fit_add <- lm(len~dose_group+supp,data=d). With R's default treatment coding and the factor levels as supplied, OJ at dose 0.5 is the reference group. The fitted intercept is 12.455, the increments for dose 1 and dose 2 are 9.130 and 15.495, and the VC coefficient is -3.700. [3]

The VC coefficient means the additive model estimates a 3.7-unit lower mean for VC than OJ after accounting for the dose categories. This model constrains the supplement difference to be the same at every dose. "Holding dose category fixed" describes the fitted comparison; it does not make the coefficient causal or establish that the common-difference constraint is correct. [8]

The additive fitted OJ mean at dose 0.5 is 12.455 rather than the raw cell mean 13.23 because the model compromises across all cells under its shared supplement-difference constraint. At dose 1, the fitted OJ value is 12.455+9.130=21.585. For VC subtract 3.700, yielding 17.885. A model fit and a raw group mean are not always the same estimate.

Ask about interaction

Fit fit_int <- lm(len~dose_group*supp,data=d). The asterisk includes dose, supplement, and their interaction. Interaction allows the fitted supplement difference to vary with dose category. In this full two-factor cell-means setting, fitted values within each cell equal that cell's observed mean.

Comparing nested models with anova(fit_add,fit_int) uses an F procedure under the relevant independent normal equal-variance error assumptions. Both models must use the same response observations; silently dropping different rows invalidates this comparison. It addresses the additional interaction terms, not every possible difference in the data. Do not choose between models only by whether one p-value falls just below 0.05. Examine estimates, uncertainty, diagnostics, and the scientific question. [6]

If interaction is retained, a single supplement coefficient describes the comparison at the reference dose, not a universal effect across doses. Report the dose-specific estimates or predicted means with an appropriate uncertainty method. This is one reason a regression table without its coding and model formula can be misleading.

Observed OJ-minus-VC mean differences are 5.25,5.93,-0.08. The additive model constrains the difference to 3.7 at each dose. Lines join observed dose categories; they do not establish an intermediate dose-response curve.
Observed OJ-minus-VC mean differences are 5.25,5.93,-0.08. The additive model constrains the difference to 3.7 at each dose. Lines join observed dose categories; they do not establish an intermediate dose-response curve.

Diagnostics and uncertainty

Use plot(fit_int,which=1) to inspect residuals against fitted values and plot(fit_int,which=2) for a normal quantile plot of standardized residuals. Also inspect the raw cell distributions. A residual plot can expose problems, but cannot verify an undocumented assignment or sampling process. Every diagnostic should be tied to an assumption it can actually inform. [7]

confint(fit_add) produces conventional model-based coefficient intervals. Their nominal coverage depends on the error and sampling assumptions. For predicted group means, supply a new data frame with the same factor levels and use predict(fit_add,newdata,interval="confidence"). A prediction interval concerns a new observation under the model and includes additional individual variation. [5] [4]

Do not reuse the same data to select many models and then present the final interval as though the model had been specified without looking. State which comparisons were planned and which were exploratory. A sensitivity analysis can show how conclusions change under another justified model, with its differences explained.

Write a report another analyst can check

A strong report states the question, dataset provenance, unit of observation, variable definitions, missingness checks, descriptive figures, model formula, assumptions, estimates, uncertainty, and limits. Keep statistical association separate from a causal interpretation. Explain why the chosen model answers the question more clearly than a bare list of outputs.

For this dataset, a defensible descriptive conclusion is that recorded cell means increase across the supplied dose levels, while the OJ-VC difference is smaller at the highest dose in this sample. Further model-based statements require the specified assumptions. The provided documentation alone does not justify a causal claim about human supplementation or a claim that the original assignment was randomized.

End the script with sessionInfo(), and save the script, data-source record, and a concise results table. If another analyst gets a different number, compare data versions, filtering, factor levels, contrast settings, model formula, and rounding before assuming either analyst made an arithmetic error.

Recap

Reproducibility means a reader can trace data to transformations to estimates. Multivariable interpretation requires the model formula, coding, and design. A transparent limitation is part of a complete answer because it identifies which questions the available evidence cannot settle.

Common misconceptions

A dataset with no missing entries does not prove no historical exclusions. An adjusted coefficient is not automatically causal.

Retrieve, check, and revisit

Close the lesson and answer from memory before revealing the feedback.

  1. What does the additive supplement coefficient constrain?
  2. What source limitation must be kept visible?
Check your reasoning
  1. The fitted supplement difference is constant across dose categories.
  2. The reviewed R help page does not fully establish allocation or the length unit; do not invent them.

Remember: A dataset with no missing entries does not prove no historical exclusions. An adjusted coefficient is not automatically causal.

On the next day, redo the worked activity without looking at its solution. About a week later, explain one assumption and solve the transfer task. These are suggested review intervals; adjust them to what you can still recall and the time until you need the material.

Sources

  1. R Core Team, R-devel 4.6.0 documentation: ToothGrowth Dataset. Read the source.
  2. R Project, official datasets source: ToothGrowth.R. Read the source.
  3. R Core Team, R-devel 4.6.0 documentation: Fitting Linear Models. Read the source.
  4. R Core Team, R-devel 4.6.0 documentation: Prediction from Linear Models. Read the source.
  5. R Core Team, R-devel 4.6.0 documentation: Confidence Intervals for Model Parameters. Read the source.
  6. R Core Team, R-devel 4.6.0 documentation: ANOVA for Linear Model Fits. Read the source.
  7. R Core Team, R-devel 4.6.0 documentation: Plot Diagnostics for an lm Object. Read the source.
  8. Hernan and Robins, Causal Inference: What If, author-hosted August 19, 2026 version. Read the source.
Key terms
Data provenance
The documented origin and transformation history of data.
Data dictionary
Definitions, units, coding, and permitted values for dataset fields.
Additive model
A model whose predictor contributions combine without the specified interaction terms.
Adjusted association
A fitted association conditional on the other included predictors.
Interaction
A model feature allowing one predictor comparison to vary with another predictor.
Reference category
The category relative to which treatment-coded coefficients are expressed.
Residual diagnostic
A check of residual behavior for possible model inadequacy.
Reproducibility
The ability to reconstruct an analysis from documented data, code, and methods.

Open the interactive version with quizzes and progress →