When two groups have different sample averages, we need a way to tell whether that gap comes from a real difference between the groups or just the random luck of who ended up in each sample.
1
Measuring the Gap Against Random Bounce
We want to find out whether an observed gap between two sample averages, xˉ1−xˉ2, is large compared to the random bounce we would expect if the two groups weren't truly different.
Suppose we split 20 students randomly into two groups of 10 to test a new study method against an old one:
Group A (new method):n1=10 students, sample mean xˉ1=84 points, sample standard deviation s1=8 points
Group B (old method):n2=10 students, sample mean xˉ2=78 points, sample standard deviation s2=6 points
Remember, each sample average has its own variance ns2, and we add the two variances together to measure the typical random bounce of the difference:
SE=n1s12+n2s22
The Two-Sample t-Statistic: Signal Over Noise
Text solution
Observed gap between the sample meansSubtract Group B's average from Group A's average to get the observed difference on top.
xˉ1−xˉ2=84−78=6 points
Standard error of the differenceAdd the variances of the two sample averages and take the square root to measure how far apart two random groups of 10 typically land by luck alone.
Two-sample t-statisticDivide the observed gap (compared to a null difference of 0) by the standard error to count how many standard errors apart the two sample averages are.
t=3.16(84−78)−0=3.166≈1.90
So the 6-point gap in favor of the new study method is 1.90 standard errors away from 0.
t=standard error (noise)n1s12+n2s22(xˉ1−xˉ2)observed gap (signal)−0null value
Even while the 6-point gap between the group averages stays at 84−78=6, smaller spreads within the two groups shrink the standard error and make t larger, while wide spreads make the standard error larger than the gap and push t toward 0.
Even when the gap between two group averages stays the same, tighter scores inside the groups shrink the random bounce and make that gap stand out more.
2
Turning t Into a p-Value and Decision
Now we want to find the probability of getting a gap of 1.90 standard errors or more in either direction just by luck when the two true population means, μ1 and μ2, are equal. Because we estimated the unknown population standard deviations σ1 and σ2 using our sample standard deviations s1 and s2, we check t=1.90 on a t-distribution rather than a standard Normal curve.
Hypotheses, Degrees of Freedom, and the P-Value
Text solution
Null and alternative hypothesesState the claim of no difference between the true population means against a two-sided alternative.
Degrees of freedom (df)Find the t-curve using technology, or take the smaller of n1−1 and n2−1 when working by hand.
Technology:dfBy hand (smaller of n1−1 and n2−1):df≈16.7=10−1=9
Two-sided p-value and decision at α=0.05Add the area in both tails beyond t=−1.90 and t=1.90, then compare that p-value to the α=0.05 cutoff.
p(by hand with df=9: p=P(∣t∣≥1.90)=0.075>0.05≈0.090>0.05)
If H0 is true, a gap of 6 points or more in either direction would happen about 7.5% of the time by random luck alone. Because p=0.075 is greater than α=0.05, we fail to reject H0.
Practical note: Technology and the by-hand rule give different degrees of freedom (16.7 vs. 9) and slightly different p-values (0.075 vs. 0.090). Always write your df right next to your t-statistic so it is clear which t-curve your p-value came from.
3
How Sample Size Changes the Test
Suppose we observed the exact same group averages (xˉ1=84 and xˉ2=78) and the exact same sample standard deviations (s1=8 and s2=6), but we tested n1=40 and n2=40 students per group instead of 10. We want to see how multiplying the sample size by 4 changes the standard error, t-statistic, and conclusion.
How Sample Size Changes the Test
Text solution
New standard error with n1=40 and n2=40Divide each group's variance by 40 instead of 10, which cuts the standard error in half.
New t-statisticDivide the same 6-point gap by the smaller standard error, doubling t.
t=1.586−0≈3.80
Two-sided p-value and decisionCheck t=3.80 in both tails against α=0.05.
pby hand with df=39: p≈0.0003<0.05(with df≈72.3;≈0.0005<0.05)
So with 40 students per group, the same 6-point gap is 3.80 standard errors away from 0, giving convincing statistical evidence to reject H0.
4
Connecting the Test to a Confidence Interval
A 95% confidence interval for μ1−μ2 gives all plausible values for the true difference using the exact same sample gap and standard error as the test:
We want to see how the 95% confidence interval for our original 10-student groups (df≈16.7, where t∗=2.11) shows the same result as our two-sided test at α=0.05.
Connecting the Test to a Confidence Interval
Text solution
Margin of error for 95% confidenceMultiply the critical value t∗=2.11 (for df≈16.7) by the standard error of 3.16 points.
t∗×SE=2.11×3.16≈6.67 points
95% confidence interval for μ1−μ2Add and subtract the margin of error from the 6-point sample difference.
6±6.67=(−0.67,12.67) points
Because 0 sits inside (−0.67,12.67), a true difference of 0 is plausible at the 95% confidence level, which matches our two-sided test failing to reject H0 at α=0.05.
When the group spreads and sample sizes stay the same, whenever the 95% confidence interval around xˉ1−xˉ2 includes 0, the two-sided p-value is greater than 0.05. Right as the edge of the interval moves past 0,∣t∣ passes t∗ and the p-value drops below 0.05.
As long as the 95% confidence interval covers 0, the two-tailed p-value stays above 0.05, and the exact instant the interval moves completely past 0, the test statistic crosses the cutoff and the p-value drops below 0.05.
5
Checking Conditions Before Running the Test
Before trusting a t-distribution to give an accurate p-value, we check that the data meet three conditions: Random, Independent, and Normal / Large Sample.
Conditions for a Two-Sample t-Test
Random: The two groups come from random assignment in an experiment or from two separate random samples selected from two populations.
Independent: The two groups are separate sets of individuals (not linked before-and-after measurements on the same people), and when sampling without replacement from finite populations, each sample is less than 10% of its population:
n1n2<10% of Population 1and<10% of Population 2
Normal / Large Sample: Both sample sizes are at least 30 (n1≥30 and n2≥30), or both populations are normally distributed. When either sample is smaller than 30, graph both groups and check that neither has strong skewness or extreme outliers.
Key concepts
Use a Two-Sample t-Test for a Difference in Means when you want to test whether two true population means differ (H0:μ1−μ2=0) using sample means xˉ1,xˉ2 and sample standard deviations s1,s2 from two separate groups. Do not use a Two-Sample t-Test when the two sets of measurements come from the same individuals (for example, 35 athletes timed before and after a warm-up routine); linked observations must be analyzed with a Paired t-Test.
Before computing t, check three conditions:
Random
Random assignment in an experiment or two independent random samples.
Independent
Separate groups, plus n1<10% of Population 1 and n2<10% of Population 2 whenever sampling without replacement.
Normal / Large Sample
Both n1≥30 and n2≥30, normal populations, or small-sample graphs with no strong skewness or extreme outliers.
When the conditions hold, compare the observed gap to the standard error by subtracting the sample averages on top and adding their sample-mean variances on the bottom:
t=n1s12+n2s22(xˉ1−xˉ2)−0
For example, with xˉ1=84,s1=8,n1=10 and xˉ2=78,s2=6,n2=10, the gap is 84−78=6 and the standard error is 1082+1062≈3.16, giving t=3.166≈1.90. Look up t on the t-curve using the df from technology or the conservative by-hand rule, the smaller of n1−1 and n2−1. For a two-sided test at α=0.05, you reject H0 (p<0.05) whenever ∣t∣>t∗, which is the exact same condition as 0 falling outside the 95% confidence interval (xˉ1−xˉ2)±t∗SE.
6
Practice
1
To test whether two reading programs produce different average comprehension scores, a researcher selects two independent random samples of students. Group 1 (Program A) has n1=16 students with sample mean xˉ1=61 points and sample standard deviation s1=12 points. Group 2 (Program B) has n2=25 students with sample mean xˉ2=50 points and sample standard deviation s2=20 points. State the null and alternative hypotheses for a two-sided test, calculate the standard error, the test statistic t, and the conservative degrees of freedom by hand, and explain in plain English what the standard error and t-statistic mean in this context.
Watch out: subtracting the variances inside the root gives ∣9−16∣=7≈2.65 and t≈4.16, and forgetting to take the square root at the end leaves SE=25 and t=2511=0.44.
Find each group's sample-mean variance ns2 first, add them to find the standard error, and check which group has the smaller sample size for df.
(Watch out: subtracting the variances inside the root gives ∣9−16∣=7≈2.65 and t≈4.16, and forgetting to take the square root at the end leaves SE=25 and t=2511=0.44.)
Test statistic
t=5(61−50)−0=511=2.20
Conservative degrees of freedom by handTake the smaller of n1−1=15 and n2−1=24, which gives df=15.(Watch out: picking the larger value gives df=24, and adding 16+25−2 gives df=39.)
Plain-English meaningSE=5 points means that if the two reading programs had the exact same true average score, random samples of 16 and 25 students would typically have sample averages that land about 5 points apart just by luck; t=2.20 means the observed 11-point gap between the two sample averages is 2.20 standard errors away from 0.
2
An industrial engineer tests whether two assembly methods differ in average completion time (μ1 and μ2, in minutes). Using two independent random samples, the observed difference is xˉ1−xˉ2=−4.2 minutes, giving a test statistic of t=−1.85 and a two-sided p-value of 0.068. (a) Interpret the p-value of 0.068 in context. (b) State the decision and conclusion at the α=0.05 significance level. (c) Explain why the standard error in the denominator adds the two sample variances (n1s12+n2s22) even though the numerator subtracts the two sample averages (xˉ1−xˉ2).
Watch out: misreading 0.068 as smaller than 0.05, like 0.0068, leads to the wrong decision of rejecting H0.
A p-value starts by assuming H0 is true; for part (c), think about what happens to the gap between the two sample averages if one bounces up while the other bounces down.
(a)Assuming the two assembly methods have the exact same true mean completion time (H0:μ1−μ2=0 is true), there is a 0.068 (6.8%) probability of getting a sample mean difference of 4.2 minutes or more in either direction just by random luck. (Watch out: do not say there is a 6.8% probability that H0 is true. The p-value is the probability of the sample result given H0, not the probability of H0 itself.)
(b)Because p=0.068>α=0.05, fail to reject H0; there is not convincing statistical evidence that the true mean completion times differ between the two assembly methods. (Watch out: misreading 0.068 as smaller than 0.05, like 0.0068, leads to the wrong decision of rejecting H0.)
(c)Both sample averages bounce randomly on their own. If Group 1's average randomly bounces one way while Group 2's average bounces the other way, the gap between them stretches from both ends, so the random variation from both groups adds to the total uncertainty.
3
In a pilot study comparing blood pressure reduction (in mmHg) for two medications, 9 patients are randomly assigned to Group 1 and 9 patients to Group 2. Group 1 has xˉ1=18 mmHg and s1=9 mmHg; Group 2 has xˉ2=10 mmHg and s2=12 mmHg. This gives SE=992+9122=5 mmHg and t=58−0=1.60, with a two-sided p-value of 0.13, failing to reject H0 at α=0.05. Suppose a larger clinical trial tests n1=81 and n2=81 patients per group and gets the exact same sample means (18 and 10 mmHg) and sample standard deviations (9 and 12 mmHg). Find the new standard error and t-statistic, and explain why the conclusion at α=0.05 changes even though the 8-mmHg gap and sample standard deviations stayed the same.
Watch out: dividing the old standard error by 9 instead of 9=3 forgets the square root over n and gives the wrong answers SE=95≈0.56 mmHg and t=14.40.
Check how multiplying both sample sizes by 9 inside the square root affects the denominator of t.
New standard error
SE=8192+81122=1+916=925=35≈1.67 mmHg
(Watch out: dividing the old standard error by 9 instead of 9=3 forgets the square root over n and gives the wrong answers SE=95≈0.56 mmHg and t=14.40.)
New test statistic
t=358−0=4.80
Why the conclusion changesMultiplying the sample size by 9 cut the standard error to one-third of its former size (1.67 mmHg instead of 5 mmHg), making the same 8-mmHg gap stand out as 4.80 standard errors instead of 1.60. With t=4.80, the two-sided p-value is far below 0.05, so we now reject H0.
4
In an experiment comparing battery life (in hours) for two phone settings with n1=12 and n2=12 phones, the sample difference is xˉ1−xˉ2=3.21 hours and the standard error is SE=1.50 hours. For a 95% confidence interval, technology (df≈20.4) gives critical value t∗=2.08, while the conservative by-hand rule (df=11) gives t∗=2.20. Construct both 95% confidence intervals, use them to determine whether the two-sided p-value for H0:μ1−μ2=0 is above or below α=0.05 under each method, and explain why the two methods disagree here.
Watch out: forgetting to multiply t∗ by SE=1.50 gives 3.21±2.08=(1.13,5.29) and 3.21±2.20=(1.01,5.41), which misses the disagreement completely.
Compute 3.21±t∗(1.50) for each critical value, then check whether the null value 0 lands inside or outside each interval.
Technology 95% confidence interval (df≈20.4)
3.21±2.08(1.50)=3.21±3.12=(0.09,6.33) hours
Because 0 is outside (0.09,6.33), the technology two-sided p-value is less than 0.05 (reject H0).
By-hand 95% confidence interval (df=11)
3.21±2.20(1.50)=3.21±3.30=(−0.09,6.51) hours
(Watch out: forgetting to multiply t∗ by SE=1.50 gives 3.21±2.08=(1.13,5.29) and 3.21±2.20=(1.01,5.41), which misses the disagreement completely. Also, remember that 0 inside the interval means 0 is plausible, so p>0.05, not p<0.05.) Because 0 is inside (−0.09,6.51), the conservative by-hand two-sided p-value is greater than 0.05 (fail to reject H0).
Why they disagreeThe test statistic here is t=1.503.21=2.14, which lands right between the two cutoffs t∗=2.08 and t∗=2.20. The cutoffs differ because the conservative df=11 curve has slightly heavier tails than the technology df≈20.4 curve, which gives a wider interval and a slightly larger p-value.
5
For each study below, determine whether all conditions for a Two-Sample t-Test are met, and if not, identify the specific condition that fails. (a) A principal takes a random sample of 40 seniors from a high school of 250 seniors and an independent random sample of 40 seniors from a rival high school of 900 seniors to compare mean SAT math scores. (b) A coach selects a random sample of 35 college athletes and records each athlete's sprint time before a new warm-up routine and again after using the routine to test whether mean sprint time changed. (c) A botanist randomly assigns 24 seedlings into two groups of 12 (one receiving a new plant food, one receiving water only) and measures height after three weeks; dotplots of the 12 heights in each group are roughly symmetric with no outliers.
Check Random, Independent (both separate groups and the 10% rule when sampling without replacement), and Normal / Large Sample in turn.
(a)Fails the Independent (10%) condition: when sampling without replacement, 40 seniors is more than 10% of the first high school's population of 250 seniors (10% of 250=25). (Watch out: seeing n1=40≥30 and n2=40≥30 only satisfies the Normal / Large Sample condition; you still have to check the 10% rule when sampling from a finite population.)
(b)Fails the Independent Groups condition: the before-and-after sprint times are measured on the exact same 35 athletes, so the two sets of scores are linked and require a Paired t-Test rather than a Two-Sample t-Test. (Watch out: a large sample size of n=35≥30 does not turn paired measurements on the same people into two independent groups.)
(c)All conditions are met: Random is met by random assignment of the 24 seedlings; Independent is met because the two groups are separate and there is no sampling without replacement from a finite population; Normal / Large Sample is met for the small samples (n1=12,n2=12) because the dotplots of both groups show no strong skewness or extreme outliers. (Watch out: n1=12<30 and n2=12<30 does not fail the Normal condition when the sample graphs are roughly symmetric with no outliers.)