Two-Sample Tests Examples: 47 Problems with Answers

Worked examples of Two-Sample Tests to try before you open each solution, then practice problems with answers.

Worked Examples

Example 1

medium
Test whether two teaching methods differ in effectiveness. Method A (nA=30, xˉA=75, sA=8) vs. Method B (nB=30, xˉB=80, sB=10). Use a two-sample z-test at α=0.05.
Show solution

Answer

z=−2.14, p≈0.032<0.05. Reject H0. Methods differ significantly.

First step

1.
H0:μA=μB; Ha:μA≠μB

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Free: full solutions on 3 topics a day. No card.

Every topic, every day: the Family plan

Example 2

hard
Construct a 95% confidence interval for μA−μB given: xˉA=50, xˉB=45, sA=6, sB=8, nA=nB=25.

Example 3

medium
Compute the standard error of xˉ1−xˉ2 given s1=5,n1=25,s2=4,n2=16.

Example 4

medium
Diet A produced xˉ1=4.5 lb loss (s1=2,n1=40); Diet B produced xˉ2=3.0 lb (s2=2.5,n2=40). Compute the Welch t-statistic.

Example 5

hard
A two-sample Welch t-test gives t=−1.10 with df ≈50, two-sided p-value ≈0.28. State the decision at α=0.05 and interpret in plain English.

Practice Problems

Try each one, then open the solution to compare your method.

Example 1

easy
When should a two-sample t-test be used instead of a z-test, and what is the key assumption about the two groups?

Example 2

hard
Two independent samples: Group 1 (n=20,xˉ=100,s=15), Group 2 (n=20,xˉ=95,s=20). Calculate the t-statistic and df for a Welch's t-test (unequal variances).

Example 3

easy
Two INDEPENDENT groups (Method A vs Method B students) are compared on mean test scores. Paired or two-sample test?

Example 4

easy
In a two-sample test of means, the usual null hypothesis says the two population means are what?

Example 5

easy
Group means are xˉ1=50 and xˉ2=44. Compute the difference in sample means xˉ1−xˉ2.

Example 6

easy
A two-proportion z-test compares two population what?

Example 7

easy
In a two-proportion z-test of H0:p1=p2, what special proportion is used to estimate the common value under the null?

Example 8

easy
The pooled proportion is p^=x1+x2n1+n2. With x1=30,x2=50,n1=100,n2=100, compute p^.

Example 9

easy
Two independent samples must satisfy which key relationship between them for a two-sample test?

Example 10

easy
A two-sample mean test gives a p-value of 0.30 at α=0.05. What is the conclusion?

Example 11

medium
Two independent samples of means: xˉ1−xˉ2=6, standard error of the difference =2. Compute the two-sample t-statistic.

Example 12

medium
The SE of a difference in means is s12n1+s22n2. With s12=16,n1=4,s22=9,n2=9, compute it.

Example 13

medium
Sample proportions p^1=0.6 (n1=50) and p^2=0.4 (n2=50). Compute the pooled proportion p^.

Example 14

medium
A two-sample t-test gives t=2.8, p-value =0.008, at α=0.05. Conclude about the two means.

Example 15

medium
A 95% CI for μ1−μ2 is (−1,5). What does it imply about a difference in means at the 5% level?

Example 16

medium
Why must you NOT use a paired t-test on two independent random samples of different people?

Example 17

medium
Build a CI for μ1−μ2: difference =8, SE =2.5, t∗=2.0.

Example 18

medium
For a two-proportion z-test, the pooled SE is p^(1−p^)(1n1+1n2). With p^=0.5, n1=n2=50, compute it.

Example 19

medium
A two-sample t-test gives t=1.0, p-value =0.33, at α=0.05. Conclude about the difference in means.

Example 20

challenge
Two independent means: xˉ1=80,xˉ2=74, s1=10,n1=25, s2=8,n2=16. Compute the t-statistic.

Example 21

challenge
A two-proportion z-test of H0:p1=p2 has successes 40/100 and 30/100. Compute the pooled p^, the SE, and the z-statistic.

Example 22

challenge
Researchers compared a drug vs placebo in two independent random groups and found a significant difference in recovery rates. A colleague suggests a paired analysis instead. Explain why the paired test is inappropriate and what would justify one.

Example 23

easy
Group 1 has xˉ1=72 and Group 2 has xˉ2=68. Compute xˉ1−xˉ2.

Example 24

easy
A two-sample test of means gives p-value 0.012. At α=0.05, what is the decision about H0?

Example 25

easy
Sample proportions: p^1=0.45 from n1=200 and p^2=0.35 from n2=200. Compute p^1−p^2.

Example 26

easy
A two-sample test of proportions gives p-value 0.21 at α=0.05. State the decision.

Example 27

medium
Two-sample t-test: xˉ1−xˉ2=9, SE=3. Compute the t-statistic for H0:μ1=μ2.

Example 28

medium
Build a 95% CI for μ1−μ2: difference =4, SE=1.5, t∗=2.0.

Example 29

medium
Compute the pooled proportion p^ for successes 36/120 and 24/80.

Example 30

medium
Pooled SE for a two-proportion z-test: p^=0.4, n1=n2=100. Compute the pooled SE.

Example 31

medium
A 99% CI for μ1−μ2 is (2,10). Does the test reject H0:μ1=μ2 at α=0.01?

Example 32

medium
Two-proportion z-test: p^1−p^2=0.08, pooled SE=0.05. Compute the z-statistic.

Example 33

medium
A 95% CI for p1−p2 is (−0.04,0.06). Does the corresponding two-sided test reject H0:p1=p2?

Example 34

medium
For independent samples with s1=6,n1=36,s2=8,n2=16, compute the SE of xˉ1−xˉ2.

Example 35

hard
Welch t-test: xˉ1=102,xˉ2=96, s1=10,n1=25,s2=8,n2=25. Compute the t-statistic.

Example 36

hard
Two-proportion z-test: p^1=0.55 (n1=200) and p^2=0.45 (n2=200). Test H0:p1=p2 — compute z.

Example 37

hard
Construct a 95% CI for p1−p2 given p^1=0.6,n1=100 and p^2=0.5,n2=100. Use z∗=1.96 and the unpooled SE.

Example 38

hard
A study uses a paired t-test on two independent random samples of unrelated subjects. State why the inference may be invalid.

Example 39

hard
A two-sample test rejects H0 with p-value 0.003 and observed difference xˉ1−xˉ2=1.2 on a 100-point exam. Is the difference necessarily practically important?

Example 40

hard
Welch t-test gives ∣t∣=2.50 with df =30. Using the rough cutoff t∗≈2.04 at the two-sided 5% level, decide whether to reject H0.

Example 41

challenge
Two independent samples: xˉ1=50,xˉ2=47,s1=s2=6,n1=n2=36. Construct a 95% CI for μ1−μ2 using t∗≈1.99.

Example 42

challenge
An investigator wants 80% power to detect a true difference of μ1−μ2=5 with common σ=10. Using the rule-of-thumb n≈2(σ)2(zα/2+zβ)2δ2 with z0.025=1.96 and z0.20=0.84, estimate n per group.

What to focus on

Core idea: Two-sample tests compare a mean or proportion between two INDEPENDENT groups to see if they truly differ.

Common stuck point: The procedure for two-sample tests is the easy part; the trap is running a two-sample test on paired data. Asking "Are the two groups made of different, unrelated subjects with no natural pairing between them?" first is what keeps a correct-looking calculation from being attached to the wrong concept.

Ask yourself: Are the two groups made of different, unrelated subjects with no natural pairing between them?

Concept recap

Hypothesis tests and confidence intervals for comparing parameters (means or proportions) of two independent populations. The two-sample t-test compares means; the two-proportion z-test compares proportions.

Comparing two independent groups is like judging two archers by their arrows. Each archer's arrows cluster around a different spot. Whether the archers really aim at different spots depends on how scattered each one's arrows are and how many arrows you have seen. A tight cluster or many arrows makes a small gap convincing.

Read the full lesson on Two-Sample Tests

Background knowledge

These ideas may be useful before you work through the harder examples.

hypothesis testingconfidence intervalsampling distributioncentral limit theorem