FreeStatisticalTools.com
Lesson 6 of 11 · 20 min

Compare two groups: t-tests and Mann-Whitney

Run independent and paired t-tests, check Levene’s test, interpret effect sizes and use the Mann-Whitney U test for skewed outcomes.

Comparing two groups is the most common analysis in thesis research. This lesson covers the three tests you need: the independent samples t-test for two separate groups, the paired t-test for two measurements of the same people, and the Mann-Whitney U test as the non-parametric alternative.

RQ1: do female and male students differ in stress?

The independent samples t-test compares the means of two unrelated groups. The null hypothesis is that the population means are equal.

Try it in the tool

Do female and male students differ in stress?

  1. Outcome Stress, grouping variable Gender, groups Female and Male.
  2. Check Levene’s test first (p = .483), then read t(238) = 2.97, p = .003.
  3. Note the effect size, d = 0.39, and the 95% CI of the difference, [0.11, 0.55].

Read the output in three steps.

  1. Group statistics. Female students: M = 3.49, SD = 0.84, n = 134. Male students: M = 3.16, SD = 0.87, n = 106.
  2. Levene’s test checks whether the two groups have similar variances. Here F = 0.49, p = .483, so equal variances can be assumed and the Student row is fine. Many journals now recommend the Welch row by default, because it is correct whether or not variances are equal; here both give t ≈ 2.97, p = .003.
  3. The test and the effect size. t(238) = 2.97, p = .003. The mean difference is 0.33 points, 95% CI [0.11, 0.55]. Cohen’s d = 0.39.

H1 is supported: female students report significantly higher stress. But how large is the difference? Cohen’s d expresses it in standard deviation units: 0.2 is small, 0.5 medium and 0.8 large. A d of 0.39 is a small-to-medium effect. Always report it, because p-values depend on sample size: with 5,000 students, a trivial difference of 0.05 points would also be “significant”.

The confidence interval matters

The 95% CI [0.11, 0.55] gives the range of population differences compatible with the data. It excludes zero (consistent with p < .05) and shows that the true difference could be as small as a tenth of a point or as large as half a point. Reporting the interval is required by APA 7 and is more informative than the p-value alone.

Paired t-test: midterm versus final

When the same students are measured twice, the scores are not independent: a student who did well in the midterm tends to do well in the final (here r = .88). The paired t-test works on each student’s difference score, which removes the stable differences between students and makes the test far more sensitive.

Try it in the tool

Did scores change from the midterm to the final?

  1. First measurement Midterm, second Final.
  2. One student without a midterm score is excluded, so n = 239.
  3. Read the result: mean difference −3.52, t(238) = −8.16, p < .001, dz = −0.53.

Scores rose from M = 56.99 (SD = 12.15) at the midterm to M = 60.51 (SD = 14.21) at the final, a mean increase of 3.52 points, 95% CI [2.67, 4.37], t(238) = −8.16, p < .001, dz = 0.53. The sign of t only reflects the order of subtraction (midterm − final). Note that dz, the effect size for paired data, is based on the SD of the differences (6.68), not of the raw scores.

Had you wrongly used an independent t-test here, the large SDs of the raw scores (12 to 14 points) would have hidden much of the effect. Always match the test to the design: two groups of different people, or the same people twice.

Mann-Whitney U: when the outcome is skewed

StudyHours is strongly skewed with outliers (Lesson 5). For comparing it between genders, the Mann-Whitney U test is safer. It ranks all values and compares the rank distributions, so extreme values have limited influence. It tests whether values in one group tend to be larger than in the other; with similar shapes, this is a comparison of medians.

Try it in the tool

Compare study hours between genders without assuming normality

  1. Outcome StudyHours, groups Female and Male.
  2. Medians 12 and 13 hours; U = 6826, z = −0.42, p = .675, r = .03.
  3. Conclude that weekly study time does not differ by gender.

Medians are 12 hours (female) and 13 hours (male), U = 6826, z = −0.42, p = .675, r = .03. There is no evidence of a gender difference in study time. The effect size r = z / √N is interpreted like a correlation: .1 small, .3 medium, .5 large.

Writing it up

An independent samples t-test showed that female students (M = 3.49, SD = 0.84) reported higher stress than male students (M = 3.16, SD = 0.87), t(238) = 2.97, p = .003, d = 0.39, 95% CI of the difference [0.11, 0.55]. Exam scores increased from the midterm (M = 56.99, SD = 12.15) to the final (M = 60.51, SD = 14.21), t(238) = 8.16, p < .001, dz = 0.53. Weekly study hours did not differ between female (Mdn = 12) and male students (Mdn = 13), U = 6826, z = −0.42, p = .675, r = .03.

In APA style, statistical symbols (t, p, d, M, SD, U) are italic, p-values have no leading zero, and exact p-values are reported to three decimals, except p < .001.

Key takeaways

  • Independent t-test for two separate groups, paired t-test for two measurements of the same people, Mann-Whitney U (or Wilcoxon signed-rank for paired data) when the outcome is skewed or ordinal.
  • Check Levene’s test, or simply report Welch’s t.
  • Always report an effect size and a 95% confidence interval, not just p.
  • A non-significant result is a finding too: report it with the same detail.

Check your understanding

Answer each question to see the explanation. Finishing the quiz marks this lesson as complete.

Q1Cohen’s d = 0.39 for the gender difference in stress. How is this usually described?
Q2Why is the paired t-test, not the independent t-test, correct for midterm versus final scores?
Q3Levene’s test gives p = .483. What does this mean?
Q4Which test is the best choice for comparing a strongly skewed variable between two independent groups?