StatsDrillFree guides

College practice · Worked answers

Two-sample t test practice

A two-sample t test compares population means from two independent groups when the population standard deviations are unknown. Start by checking how the data were collected. Two columns do not automatically mean two independent samples: before-and-after measurements on the same people are paired.

Choose the independent-samples model

Welch’s two-sample t test allows different population variances. It uses both sample standard deviations without assuming they estimate one common variance. A pooled t test adds an equal-variance assumption; do not pool just because the sample sizes happen to match.

Check independence within and between samples, how the observations were sampled or assigned, and whether the mean’s sampling distribution is reasonable. With small samples, strong skew or outliers deserve particular attention. A large sample does not fix dependence or selection bias.

Build the statistic from three pieces

SE = √(s₁²/n₁ + s₂²/n₂)

t = [(x̄₁ − x̄₂) − Δ₀] / SE

Δ₀ is the hypothesized population difference, often zero. Keep the subtraction order consistent in the hypothesis, estimate, and conclusion. For Welch’s method, let a = s₁²/n₁ and b = s₂²/n₂. Then df = (a + b)² / [a²/(n₁ − 1) + b²/(n₂ − 1)]. Software normally keeps noninteger degrees of freedom.

Avoid the two-column trap

Which comparison fits the design?
DataUsual starting point
Different randomly sampled people in each groupIndependent two-sample method
The same people measured twicePaired method on within-person differences
Counts of success and failureProportion methods, not a test of numerical means

Work through two examples

Work a Welch test with simple numbers

  1. Independent samples have n₁ = n₂ = 10, x̄₁ = 18, x̄₂ = 15, and s₁ = s₂ = 3. Assume the model conditions hold. Test a zero difference against a two-sided alternative at α = 0.05.
  2. SE = √(9/10 + 9/10) = √1.8 ≈ 1.3416. Then t = 3/1.3416 ≈ 2.2361.
  3. Welch df = 1.8² / [(0.9²/9) + (0.9²/9)] = 18. The two-sided p-value is about 0.03825, so reject the zero-difference null at 0.05.

Notice when the setup is paired

  1. Twelve students take a test before and after a study workshop. Each row belongs to one student.
  2. The observations across columns are linked, so an independent two-sample analysis would ignore that design.
  3. Compute each student’s after-minus-before difference, then use a paired t method if its conditions hold. There are 12 differences, not 24 independent students.

Try it yourself

Choose an answer, then check your reasoning. You can retry any question or open its solution.

1. For s₁ = 4, n₁ = 16, s₂ = 6, n₂ = 36, what is the Welch SE?
Show solution 1

√2, about 1.414. SE = √(16/16 + 36/36) = √2. Add the variance contributions before taking the square root.

Why the other choices are wrong:

  • 2: You stopped before the square root: 16/16 + 36/36 = 2. Take √2 at the end. (Adding 4/√16 + 6/√36 also gives 2, but standard errors don’t add; variances do.)
  • 10: That adds the standard deviations, 4 + 6. Square each one, divide by its own n, add, then take the square root.
  • About 0.417: That divides s by n without squaring: 4/16 + 6/36. Use s²/n.
2. A difference estimate is 6, the null difference is 0, and SE = 2. What is t?
Show solution 2

3. t = (6 − 0)/2 = 3. The estimate is three standard errors above the null difference.

Why the other choices are wrong:

  • 12: That multiplies by the SE. Divide by it instead.
  • 0.333: That is SE divided by the estimate. Flip it: estimate ÷ SE.
  • 4: 6 − 2 subtracts the SE. Divide the difference by the SE.
3. Which data call for a paired approach?
Show solution 3

Each participant measured before and after. Measurements on the same participant are linked. A paired analysis studies the within-person differences.

Why the other choices are wrong:

  • Two separate random groups: Separate random groups are independent. Nothing links an observation in one group to one in the other.
  • Two groups with equal sample sizes: Equal sizes can happen by design or by chance. Pairing needs a real link, like the same person measured twice.
  • Treatment and control groups made of different patients: Different patients in each group aren’t linked, so these are independent samples.
4. What extra assumption distinguishes the pooled two-sample t test from Welch’s test?
Show solution 4

Equal population variances. Pooling uses a common population variance assumption. Welch’s approach does not require that equality.

Why the other choices are wrong:

  • Equal sample sizes: Pooling doesn’t require equal n. It assumes the population variances are equal.
  • Known population standard deviations: If the σ values were known, you would use z. Both t tests estimate spread from the samples.
  • Equal sample means: Equal population means is usually what H₀ says. It isn’t an assumption of the pooled method.
5. A valid two-sided test gives p = 0.08 at α = 0.05. What can you conclude?
Show solution 5

Insufficient evidence of a population mean difference. The p-value is above α. Failing to reject the zero-difference null is not proof of equality or absence of an effect.

Why the other choices are wrong:

  • The means are proven equal: Not rejecting doesn’t prove the means are equal.
  • There is no possible effect: There could be a real effect that this study was too small to detect.
  • Reject H₀, because 0.08 is small: 0.08 is larger than 0.05, so you don’t reject at this α.
6. Independent groups: x̄₁ = 24, s₁ = 4, n₁ = 8 and x̄₂ = 20, s₂ = 2, n₂ = 8. What is the Welch t for a zero null difference?
Show solution 6

About 2.53. SE = √(16/8 + 4/8) = √2.5 ≈ 1.581. Then t = (24 − 20)/1.581 ≈ 2.53.

Why the other choices are wrong:

  • 4: 4 is just the difference in means. Divide it by the SE.
  • About 1.60: That divides by 2.5, the sum of variance terms, before taking the square root. SE = √2.5 ≈ 1.58.
  • About 0.67: That divides by s₁ + s₂ = 6. The SE is √(s₁²/n₁ + s₂²/n₂).
7. Twelve students take a test before and after a workshop. For a paired t test, how many differences and degrees of freedom are there?
Show solution 7

12 differences, df = 11. Each student gives one after-minus-before difference, so n = 12. A paired t test is a one-sample t test on those differences, with df = 12 − 1 = 11.

Why the other choices are wrong:

  • 24 observations, df = 22: That treats 24 independent students. The pairs make 12 differences.
  • 12 differences, df = 12: The count is right, but a one-sample t test on the differences uses n − 1 = 11.
  • 24 observations, df = 23: There are only 12 independent units; each student contributes one difference.
8. Hₐ: μ₁ − μ₂ > 0. Group 1’s sample mean is 3 higher than group 2’s, and SE = 1.5. Which t matches the hypotheses?
Show solution 8

t = 2. Keep the same subtraction order as the hypotheses: t = (x̄₁ − x̄₂ − 0)/SE = 3/1.5 = 2. A positive t points in the direction of Hₐ.

Why the other choices are wrong:

  • t = −2: That uses x̄₂ − x̄₁. Match the order in the hypotheses: x̄₁ − x̄₂ = +3.
  • t = 0.5: That is SE divided by the difference. Flip it.
  • t = 4.5: That adds the SE. Divide by it instead.

Answer key

Open all answers
  1. √2, about 1.414. SE = √(16/16 + 36/36) = √2. Add the variance contributions before taking the square root.
  2. 3. t = (6 − 0)/2 = 3. The estimate is three standard errors above the null difference.
  3. Each participant measured before and after. Measurements on the same participant are linked. A paired analysis studies the within-person differences.
  4. Equal population variances. Pooling uses a common population variance assumption. Welch’s approach does not require that equality.
  5. Insufficient evidence of a population mean difference. The p-value is above α. Failing to reject the zero-difference null is not proof of equality or absence of an effect.
  6. About 2.53. SE = √(16/8 + 4/8) = √2.5 ≈ 1.581. Then t = (24 − 20)/1.581 ≈ 2.53.
  7. 12 differences, df = 11. Each student gives one after-minus-before difference, so n = 12. A paired t test is a one-sample t test on those differences, with df = 12 − 1 = 11.
  8. t = 2. Keep the same subtraction order as the hypotheses: t = (x̄₁ − x̄₂ − 0)/SE = 3/1.5 = 2. A positive t points in the direction of Hₐ.

Common questions

Do equal sample sizes mean the data are paired?

No. Pairing requires a meaningful link between observations, such as repeated measurements on the same person.

Should I always pool the variances?

No. Use the method specified by the problem and justified by the assumptions. Welch’s method allows unequal population variances.

Why can Welch degrees of freedom be a decimal?

They come from an approximation based on the estimated variance contributions. Software can use the noninteger value directly.

Keep practicing

Try 3 days free

3-day free trial, no card needed.

Sources and fact checks

Definitions and methods checked against these textbook references. Practice scenarios and worked numbers were written for this guide.