Independent-samples t-test
Compare the means of two independent groups, with Levene's test and Welch's t.
8 min read
Try it
One click opens the “Exam scores” sample dataset with this test selected and the variables filled in. Or use your own data.
The independent-samples t-test answers one question: do the means of two unrelated groups differ? For example, male vs female students' scores, or satisfaction in an experimental vs a control group.
When to use it
- The grouping variable is categorical with exactly two groups (gender, treatment/control).
- The outcome is numeric (a score, income, a mean scale score).
- Each person belongs to only one group (independent observations).
With three or more groups, use one-way ANOVA. When the same people are measured twice, use the paired t-test.
The idea
The t statistic is the ratio between "the difference in means" and "the error you would expect from random sampling". When the difference is much larger than that error, t is large and p is small.
Assumptions Lucidstat checks
- Normality within each group, with Shapiro–Wilk.
- Equal variances, with median-centred Levene's test.
- If p ≥ .05, Student's t is reported (equal variances assumed).
- If p < .05, Welch's t is reported. It does not assume equal variances and has fractional degrees of freedom.
If a group is not normal and has fewer than 30 cases, Lucidstat suggests the Mann–Whitney U test. See also Assumptions.
Worked example
The "Exam scores" sample has 40 students in groups A and B (20 each). Do the two groups differ in exam score?
Checking assumptions
- Levene's test: F(1, 38) = 0.00, p = .983. Variances are equal, so Student's t is used.
- Shapiro–Wilk: group A W = .965, p = .641; group B W = .952, p = .404. Both look approximately normal.
| Group | n | M | SD |
|---|---|---|---|
| A | 20 | 69.80 | 12.45 |
| B | 20 | 68.85 | 12.05 |
| t | df | p | Mean difference | 95% CI | Cohen's d |
|---|---|---|---|---|---|
| 0.25 | 38 | .808 | 0.95 | [−6.89, 8.79] | 0.08 |
How to read it
- p = .808 is above .05, so do not reject H₀: the groups do not differ significantly.
- The 95% CI for the difference, [−6.89, 8.79], includes 0, which agrees with the non-significant result.
- d = 0.08 is below the "small" benchmark of 0.20: there is practically no difference.
An independent-samples t-test showed no significant difference in Exam score between A (M = 69.80, SD = 12.45) and B (M = 68.85, SD = 12.05), t(38) = 0.25, p = .808, mean difference = 0.95, 95% CI [−6.89, 8.79], d = 0.08.
ผลการทดสอบค่าที (Independent-samples t-test) พบว่า คะแนนสอบของ A (x̄ = 69.80, S.D. = 12.45) และ B (x̄ = 68.85, S.D. = 12.05) ไม่แตกต่างกันอย่างมีนัยสำคัญทางสถิติ (t(38) = 0.25, p = .808)
Common mistakes
- Running several t-tests instead of ANOVA. With three groups, testing every pair inflates the Type I error rate.
- Using the independent t-test on pre/post data from the same people. Use the paired t-test.
- Ignoring Levene's test and reporting Student's t when variances differ. Lucidstat picks the right version, but say which one you used.
- Reporting only p. Include means, SDs and the effect size.
References
- Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum.
- Welch, B. L. (1947). The generalization of "Student's" problem when several different population variances are involved. Biometrika, 34(1–2), 28–35.
Try it
One click opens the “Exam scores” sample dataset with this test selected and the variables filled in. Or use your own data.