
carry out two-sample t-tests and two-proportion z-tests, compare them with randomization tests, and match each conclusion to what the study design allows.
Instruction
Two-sample t-test. For H0: μ1 = μ2,
t = (x̄1 − x̄2) / √(s12/n1 + s22/n2)
with df from technology (Welch), or conservatively the smaller n minus 1. Conditions: two independent random samples or two groups from random assignment; normal or large samples in each group.
Example 1: a randomized experiment (illustrative data from RLP Statistics A). Silence: x̄ = 13.2 words, s = 1.93, n = 10. Music: x̄ = 11.0, s = 1.83, n = 10. H0: μsilence = μmusic; Ha: ≠.
t = 2.2 / √(1.932/10 + 1.832/10) = 2.2/0.841 ≈ 2.62, df ≈ 17.9, P ≈ 0.018
The exact randomization test from RLP Statistics A gave a two-sided P of 0.025. The two methods agree closely, as they usually do when conditions are met. The t-test is a formula that approximates the randomization distribution. Scope: random assignment means the difference was caused by the treatment, for these volunteers.
Two-proportion z-test. For H0: p1 = p2, pool the samples to estimate the common p under H0:
p̂c = (x1 + x2)/(n1 + n2), z = (p̂1 − p̂2) / √(p̂c(1 − p̂c)(1/n1 + 1/n2))
Example 2: rain persistence (NOAA, observational). St. Louis winters 2000-2024: rain followed 294 of 688 rainy days (0.427) and 396 of 1,568 dry days (0.253). Pooled p̂c = 690/2,256 ≈ 0.306; SE ≈ 0.0211; z = 0.175/0.0211 ≈ 8.29; P is far below 0.001. Rain is far more likely after a rainy day. Scope: this is an observational record, and the explanation (storms last more than a day) comes from meteorology, not from the test. The days are also not independent draws, so the test’s P-value is too small to be taken literally. The effect, however, is large enough that no reasonable correction changes the conclusion.
Example 3: two eras (NOAA, observational). Annual mean temperature, 1995-2024 versus 1950-1979:
- St. Louis: 57.89 versus 55.32°F; t ≈ 6.52, P < 0.001.
- Springfield: 57.08 versus 55.66°F; t ≈ 3.89, P ≈ 0.0003.
Both differences are statistically significant at α = 0.05, and the St. Louis difference (2.57°F) is nearly twice the Springfield one (1.42°F). Scope: these are not random samples, and nothing was assigned. The tests show that the later era’s values are higher than the earlier era’s year-to-year variation would explain. They do not identify causes. The St. Louis station sits in a large metropolitan area that has grown since 1950, and all stations have had equipment changes over the decades. Separating regional climate change from local effects needs more evidence, such as comparisons with rural stations and the scientific literature.
The scope-of-inference table.
| Random assignment | No random assignment | |
|---|---|---|
| Random selection | Causal, and generalizes to the population | Association in the population; not causal |
| No random selection | Causal for the units studied | Association in the units studied only |
Put every conclusion you write in one of those four boxes.
📖 Read for this lesson
The reading opens over the lesson; close it to come back to exactly where you were. The checks below draw on it.
Formative check
Work through these before moving on. They are not graded — they tell you whether the standard below has landed yet.
The music experiment’s t-test gives P ≈ 0.018 and the randomization test gives P ≈ 0.025. What does this show?
Because the St. Louis two-era test has P < 0.001, it proves the warming was caused by regional climate change.
Random assignment
Tap to revealSupports cause and effect.
Random selection
Tap to revealSupports generalizing to the population.
Paired data
Tap to revealTest the differences (paired t).
Two proportions under H₀
Tap to revealUse the pooled p̂ in the SE.
Carry out a two-sample t-test comparing 1995-2024 with 1950-1979 for a Missouri station and variable of your choice (NOAA Global Summary of the Year; the Lesson 2.4 reading has St. Louis, Springfield and Joplin temperatures). Give hypotheses, conditions, t, df, P-value and a 95% interval for the difference. Then write a scope statement that places your conclusion in the correct box of the scope-of-inference table, naming one alternative explanation.
How confident are you that you can carry out two-sample tests and state conclusions that match the study design?
Practice
Work these on paper or in your notebook, then open Check your answer. Aim for all of Fluency and Application; try at least one Challenge.
Printable version: this unit’s practice workbook (PDF)
Fluency
Build speed and accuracy with the core skill.
- Two independent samples: x̄₁ = 13.2, s₁ = 1.93, n₁ = 10; x̄₂ = 11.0, s₂ = 1.83, n₂ = 10. Find the two-sample t statistic.
Check your answer
Answer: t ≈ 2.62. - Two proportions: 45 of 100 and 30 of 100. Find the pooled proportion and the z statistic for H₀: p₁ = p₂.
Check your answer
Answer: p̂c = 0.375; z ≈ 2.19. - Random assignment, no random selection: what can the conclusion claim?
Check your answer
Answer: Cause and effect for the units studied; generalizing beyond them is a judgment. - Random selection, no random assignment: what can the conclusion claim?
Check your answer
Answer: Association in the population; not causation. - A two-sample t-test gives t = 2.62 with df = 17.9. Find the two-sided P-value.
Check your answer
Answer: ≈ 0.0174. - Why use the pooled proportion in a two-proportion test but not in the interval?
Check your answer
Answer: The test assumes H₀: p₁ = p₂, so both samples estimate one common p; the interval makes no such assumption.
Application
Use the skill in context. Show your reasoning.
- (Illustrative data, RLP Statistics A) The helicopter experiment: long blades mean 2.5063 s, short 2.3812 s, n = 8 each. A two-sample t-test gives t ≈ 2.78, df ≈ 13.7, two-sided P ≈ 0.0148. The exact randomization test gave a one-sided P of about 0.0099. Compare and conclude.
Check your answer
Answer: The t-test’s one-sided P would be about 0.0074, close to the randomization value; both give convincing evidence that longer blades increased flight time for these randomly assigned helicopters. - Springfield winter days 2000-2024: rain followed 234 of 584 rainy days and 353 of 1,672 dry days. Carry out a two-proportion z-test and state the scope.
Check your answer
Answer: Pooled p̂ ≈ 0.260; z ≈ 9.0; P far below 0.001. Rain is much more likely after a rainy day. Observational record from one station; consecutive days are not independent, so the P-value is too small to take literally, but the effect is too large to be chance. - Joplin annual mean temperature, 1995-2024 against 1950-1979 (NOAA): means 58.77 and 57.39°F. A Welch test gives t ≈ 3.87, df ≈ 58.0, P ≈ 0.0003. State the conclusion and its scope.
Check your answer
Answer: Convincing evidence that Joplin’s recent years averaged warmer than the earlier era, by about 1.38°F. The record is observational at one airport station, so the test does not identify the cause.
Challenge
Stretch problems. Expect to think before you write.
- Show that for a 2 × 2 table the square of the two-proportion z statistic equals the chi-square statistic, using the St. Louis winter values z ≈ 8.29 and χ² ≈ 68.8.
Check your answer
Answer: 8.29² ≈ 68.8, matching χ² ≈ 68.8 (any small gap is rounding). The two-sided two-proportion z-test and the 2 × 2 chi-square test are the same test.
Review
Keep earlier skills sharp.
- (Unit 2) Paired or independent: before-and-after blood pressure on the same 30 patients?
Check your answer
Answer: Paired. - (RLP Statistics A) What design feature supports a causal conclusion?
Check your answer
Answer: Random assignment of treatments.
A Randomized Experiment and Three Observational Comparisons: Two-Sample Tests Worked in Full
Memory-experiment data as written for RLP Statistics A (illustrative); annual mean temperature from NOAA NCEI Global Summary of the Year, TAVG, stations USW00013994 (St. Louis), USW00013995 (Springfield) and USW00013987 (Joplin), 1950-1979 and 1995-2024; retrieved 2026-11-10 · SLS original, with public domain NOAA data
Why this reading. The lesson’s first example is “illustrative data from RLP Statistics A”: a memory experiment whose twenty scores live in another course. Its third example gives St. Louis’s two-era test as a bare t and P, with no SDs to reproduce them from. The workshop then asks for a two-sample test of your own, with the interval and a scope statement. This reading supplies the twenty scores, works the era tests in full for three Missouri stations, so the open question can be done from the Lesson 2.4 reading’s data or from the summaries here. The critical-values reading has the t tables.
Table 1. The memory experiment (illustrative, from RLP Statistics A)
Twenty volunteers were randomly assigned, ten to study a word list in silence and ten with music playing; the response is words recalled. The data were written for RLP Statistics A to teach the randomization test and are not from a real study.
| Student | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Mean | SD |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Silence | 14 | 12 | 15 | 11 | 13 | 16 | 12 | 14 | 10 | 15 | 13.2 | 1.932 |
| Music | 11 | 9 | 13 | 12 | 10 | 8 | 12 | 11 | 14 | 10 | 11.0 | 1.826 |
Two-sample t, worked. Difference 13.2 − 11.0 = 2.2 words. SE = √(1.9322/10 + 1.8262/10) = √(0.3733 + 0.3333) = 0.841. t = 2.2/0.841 = 2.62. Welch df = (0.3733 + 0.3333)2/(0.37332/9 + 0.33332/9) = 17.9. From Table 2 of the critical-values reading at df 18: the tail beyond 2.5 is 0.0112 and beyond 3.0 is 0.0038, so two-sided P is between 0.008 and 0.022; T.DIST.2T gives 0.017. Conservative df = 9 gives t* = 2.262 and P ≈ 0.028. Interval: 2.2 ± 2.101(0.841) = 0.4 to 4.0 words, the lesson’s “roughly 0.4 to 4.0”.
Against the randomization test. RLP Statistics A shuffled the twenty scores into two groups of ten many times and found a difference of 2.2 or more in either direction about 2.5% of the time. The t-test’s 0.017 is the normal-curve approximation to that shuffling distribution. Both say: with random assignment and no real effect, a gap this large is unusual. Scope: random assignment, no random selection: causal for these twenty volunteers, and generalizing beyond them is an argument about similarity, not a statistical result.
Table 2. Two eras at three Missouri stations (real; NOAA Global Summary of the Year)
Annual mean temperature, 1950–1979 against 1995–2024, 30 years each. The year-by-year values are in the Lesson 1.2 reading (St. Louis and Springfield) and the Lesson 2.4 reading (all three stations, both eras).
| Station | Earlier mean (SD) | Later mean (SD) | Difference | SE | Welch df | t | Two-sided P | 95% interval |
|---|---|---|---|---|---|---|---|---|
| St. Louis | 55.317 (1.358) | 57.890 (1.681) | 2.573 | 0.3945 | 55.5 | 6.52 | < 0.0001 | 1.78 to 3.36 |
| Springfield | 55.663 (1.298) | 57.080 (1.516) | 1.417 | 0.3644 | 56.6 | 3.89 | 0.0003 | 0.69 to 2.15 |
| Joplin | 57.390 (1.394) | 58.770 (1.365) | 1.380 | 0.3562 | 58.0 | 3.87 | 0.0003 | 0.67 to 2.09 |
St. Louis, worked. SE = √(1.3582/30 + 1.6812/30) = 0.3945; t = 2.573/0.3945 = 6.52; df 55.5; from the df-56 row of the t-table reading the tail beyond 3.5 is 0.0005, so the two-sided P is far below 0.001 and technology says < 0.0001. That is the lesson’s t ≈ 6.52. The interval, 1.78 to 3.36°F, is the effect size the P-value hides: the later era is warmer by somewhere between about 1.8 and 3.4 degrees.
Springfield and Joplin sit lower: t = 3.89 (P = 0.0003) and t = 3.87 (P = 0.0003), both significant at 0.05 and at 0.001, with differences near 1.4°F. Three stations, one clear pattern and one much larger value, and the same design in every case: no random sampling, no assignment. All three belong in the same box of the scope table, association in the units studied, and the alternative explanations (urban growth around the St. Louis airport, instrument and siting changes, the warm years since 2012) are the same for all three. Do not let one big t at one station stand for “Missouri”.
For the workshop
Take a station and variable from the Lesson 2.4 reading (temperature) or, for precipitation eras, ask whether the Lesson 3.2 reading’s 1995–2024 rain totals can be compared with anything (they cannot, without the earlier era; that is a data-availability limit worth stating rather than working around). Give hypotheses, check the shape of each era with a dot plot, compute t and the Welch df by the formula above, find the P-value, give the 95% interval for the difference, and write a scope sentence that places your conclusion in the right box of the scope-of-inference table and names one alternative explanation.
Sources: NOAA NCEI, Global Summary of the Year data search (ncei.noaa.gov); NOAA NCEI Access Data Service (the query used here) (ncei.noaa.gov)
Two Eras and Two Cities: The Annual Temperatures Behind the Comparison Intervals
NOAA NCEI Global Summary of the Year, element TAVG, stations USW00013994 (St. Louis), USW00013995 (Springfield) and USW00013987 (Joplin) for 1950-1979 and 1995-2024; retrieved 2026-11-10 · Public domain (works of the United States government), with SLS original worked computation
Why this reading. The lesson’s three worked intervals rest on 120 annual values it never prints: St. Louis in two eras, and St. Louis against Springfield year by year. The workshop then asks you to build one paired and one two-sample interval of your own from the same NOAA product. Both jobs need the numbers. They are here, arranged so the lesson’s figures can be recomputed, and so that other pairings (Joplin’s two eras, St. Louis minus Joplin) can be built from the same table.
Table 1. Annual mean temperature (°F), NOAA Global Summary of the Year
Stations USW00013994 (St. Louis Lambert International Airport), USW00013995 (Springfield-Branson National Airport) and USW00013987 (Joplin Regional Airport). Left block: the earlier era, 1950–1979. Right block: the later era, 1995–2024, with the paired St. Louis minus Springfield difference. Retrieved 2026-11-10; no year is missing.
| Year | St. Louis | Springfield | Joplin | Year | St. Louis | Springfield | Joplin | St. Louis − Springfield |
|---|---|---|---|---|---|---|---|---|
| 1950 | 54.4 | 54.3 | 56.0 | 1995 | 57.0 | 56.2 | 58.1 | +0.8 |
| 1951 | 54.4 | 54.2 | 56.0 | 1996 | 54.9 | 54.3 | 57.4 | +0.6 |
| 1952 | 57.2 | 56.7 | 58.8 | 1997 | 55.1 | 54.4 | 57.3 | +0.7 |
| 1953 | 58.5 | 58.2 | 60.3 | 1998 | 58.7 | 57.9 | 59.7 | +0.8 |
| 1954 | 58.5 | 58.7 | 61.2 | 1999 | 57.9 | 57.6 | 59.4 | +0.3 |
| 1955 | 57.2 | 56.1 | 58.3 | 2000 | 56.1 | 55.9 | 58.1 | +0.2 |
| 1956 | 57.0 | 56.9 | 59.0 | 2001 | 57.7 | 56.6 | 59.2 | +1.1 |
| 1957 | 56.3 | 56.0 | 58.0 | 2002 | 57.8 | 56.2 | 58.6 | +1.6 |
| 1958 | 54.1 | 54.2 | 56.4 | 2003 | 56.5 | 55.8 | 58.3 | +0.7 |
| 1959 | 56.3 | 55.5 | 57.7 | 2004 | 57.5 | 56.7 | 58.6 | +0.8 |
| 1960 | 54.6 | 54.7 | 56.3 | 2005 | 58.0 | 57.8 | 59.4 | +0.2 |
| 1961 | 53.8 | 54.7 | 56.8 | 2006 | 58.5 | 58.8 | 60.6 | −0.3 |
| 1962 | 54.6 | 55.5 | 58.1 | 2007 | 58.3 | 58.1 | 59.1 | +0.2 |
| 1963 | 54.3 | 57.2 | 58.1 | 2008 | 55.4 | 55.1 | 57.4 | +0.3 |
| 1964 | 56.0 | 56.7 | 57.6 | 2009 | 56.6 | 55.2 | 56.7 | +1.4 |
| 1965 | 56.0 | 56.9 | 58.9 | 2010 | 58.0 | 56.5 | 58.3 | +1.5 |
| 1966 | 54.1 | 54.5 | 56.2 | 2011 | 58.7 | 57.0 | 59.0 | +1.7 |
| 1967 | 54.6 | 55.3 | 56.8 | 2012 | 61.2 | 59.5 | 61.5 | +1.7 |
| 1968 | 54.5 | 54.2 | 55.8 | 2013 | 56.4 | 55.4 | 56.3 | +1.0 |
| 1969 | 54.6 | 55.1 | 56.9 | 2014 | 55.8 | 55.3 | 56.1 | +0.5 |
| 1970 | 55.0 | 54.6 | 57.1 | 2015 | 58.8 | 57.8 | 58.7 | +1.0 |
| 1971 | 56.2 | 56.7 | 58.4 | 2016 | 60.4 | 59.4 | 60.3 | +1.0 |
| 1972 | 54.6 | 55.8 | 57.8 | 2017 | 60.2 | 59.1 | 60.4 | +1.1 |
| 1973 | 55.9 | 56.6 | 57.7 | 2018 | 57.4 | 57.6 | 58.1 | −0.2 |
| 1974 | 54.8 | 55.7 | 56.5 | 2019 | 57.2 | 57.4 | 57.7 | −0.2 |
| 1975 | 55.3 | 55.7 | 56.8 | 2020 | 58.2 | 57.2 | 58.9 | +1.0 |
| 1976 | 54.0 | 55.0 | 54.9 | 2021 | 59.0 | 57.7 | 59.2 | +1.3 |
| 1977 | 55.4 | 56.9 | 57.4 | 2022 | 57.8 | 57.1 | 58.9 | +0.7 |
| 1978 | 53.2 | 53.9 | 56.4 | 2023 | 60.4 | 59.1 | 60.4 | +1.3 |
| 1979 | 54.1 | 53.4 | 55.5 | 2024 | 61.2 | 59.7 | 61.4 | +1.5 |
Summary statistics, for checking
| Series | n | Mean | Sample SD |
|---|---|---|---|
| St. Louis 1950–1979 | 30 | 55.317 | 1.358 |
| St. Louis 1995–2024 | 30 | 57.890 | 1.681 |
| Springfield 1950–1979 | 30 | 55.663 | 1.298 |
| Springfield 1995–2024 | 30 | 57.080 | 1.516 |
| Joplin 1950–1979 | 30 | 57.390 | 1.394 |
| Joplin 1995–2024 | 30 | 58.770 | 1.365 |
The lesson’s two-sample interval, with the Welch degrees of freedom shown
St. Louis, later minus earlier: 57.89 − 55.32 = 2.573°F. SE = √(1.3582/30 + 1.6812/30) = √(0.06145 + 0.09415) = 0.3945. Technology’s df comes from the Welch formula, which you can evaluate yourself: with v1 = s12/n1 and v2 = s22/n2,
df = (v1 + v2)2 / (v12/(n1 − 1) + v22/(n2 − 1)) = (0.06145 + 0.09415)2 / (0.061452/29 + 0.094152/29) = 55.5.
From the critical-values reading, t* at df = 56 is about 2.003 (technology, at 55.55, gives 2.0036). Interval: 2.573 ± 2.004(0.3945) = 1.78 to 3.36°F. The conservative df = 29 gives t* = 2.045 and 1.77 to 3.38. Welch df always lands between the smaller n − 1 and n1 + n2 − 2; when the two SDs are close it is near the top of that range.
The lesson’s paired interval
The 30 differences in the last column sum to 24.3, so d̄ = 0.8100; sd = 0.5689; SE = 0.5689/√30 = 0.1039; t* = 2.045 (df = 29); interval 0.598 to 1.022°F. 27 of the 30 differences are positive: St. Louis ran warmer than Springfield in 27 of the 30 years (the airport sits in a large urban area, and Springfield’s station is on a higher plateau).
What pairing bought. Treat the same 60 values as two independent samples instead. SE = 0.4133, Welch df 57.4, t* 2.002, interval -0.02 to 1.64°F: the same center and a width of 1.65 against 0.42. Nearly four times wider, and for nothing. Warm years and cool years hit both airports together, and the paired analysis subtracts that shared swing out before it measures the gap.
For the workshop: two more pairings this table supports
Joplin, two eras (two-sample). 58.770 − 57.390 = 1.380; SE = 0.3562; Welch df 58.0. Finish it: the interval, and a scope sentence. Compare its width with St. Louis’s and say why the two stations’ differences are so different in size.
St. Louis minus Joplin, paired, 1995–2024. Compute the 30 differences from the right block. Before you compute an interval, plot them against year: is there a trend? A paired t-interval assumes the differences are draws from one stable process, and if they drift, the interval describes an average of something that is changing. (For reference, the mean of the 30 differences is -0.880°F.)
Whatever you build, the scope statement is the same shape as the lesson’s: these are not random samples of anything; the interval treats the years as draws from the climate of an era at a fixed instrument, and it says how big a difference is relative to year-to-year variation, not what caused it.
Sources: NOAA NCEI, Global Summary of the Year data search (ncei.noaa.gov); NOAA NCEI Access Data Service (the query used here) (ncei.noaa.gov)