Unit 3 · Compare groups
How to run an independent-samples t-test in SPSS
Run and interpret an independent-samples t-test in SPSS, including Levene's test, Cohen's d and an APA write-up.
Quick answer: How do you run an independent-samples t-test in SPSS?
- Click Analyze › Compare Means › Independent-Samples T Test.
- Move the outcome into Test Variable(s) and the group variable into Grouping Variable.
- Click Define Groups, enter the two group codes, then click OK.
- Check Levene’s test, then read the matching row of the t-test table.
Report it in APA style: Online students scored higher than in-person students, t(98) = 2.51, p = .014, d = 0.50.
What is an independent-samples t-test?
An independent-samples t-test compares the means of two separate groups on one Scale outcome, to decide whether the difference between them is bigger than you’d expect by chance.
When to use it
- Two groups made up of different people, such as online vs in-person students.
- One Scale outcome, such as an exam score.
- If the outcome is ordinal or clearly non-normal, use Mann-Whitney U instead.
How it works
t is the difference between the two means divided by the standard error of that difference: signal divided by noise. A big difference with little spread gives a large t and a small p. The p-value is the probability of a difference at least this large if the population means were really equal. Cohen’s d expresses the difference in standard deviation units: about 0.2 is small, 0.5 medium and 0.8 large.
Assumptions
- The outcome is Scale and roughly normal in each group.
- The two groups are independent: nobody is in both.
- Similar variances in the two groups. Levene’s test checks this; if it’s significant, read the “Equal variances not assumed” (Welch) row.
Worked example
Online students (M = 71.20, SD = 10.40) scored higher than in-person students (M = 65.80, SD = 11.10), t(98) = 2.51, p = .014, d = 0.50: a medium-sized difference.
Key terms
- Null hypothesis
- The assumption of no difference that the test tries to reject.
- p-value
- Probability of a result this extreme if the null hypothesis were true.
- Degrees of freedom
- For this test, total N − 2.
- Cohen’s d
- Mean difference divided by the pooled SD.
Common mistakes
- Using it for the same people measured twice (that needs a paired t-test).
- Reading the wrong row of the output after Levene’s test.
- Saying the result “proves” a difference, or that p = .06 “shows no difference”.
- Using causal language when groups weren’t randomly assigned.
How to do it in SPSS
The SPSS syntax
Prefer typing to clicking? Open File › New › Syntax, paste this in, select it and choose Run › Selection. Every dialog's Paste button writes the same kind of code.
T-TEST GROUPS=teaching(1 2)
/MISSING=ANALYSIS
/VARIABLES=score
/ES DISPLAY(TRUE)
/CRITERIA=CI(.95).Practice data
Download the file used in this lesson and run it yourself in SPSS: you should get the same results as the screens above.
- online.savExam scores for online and in-person students (N = 100)
Now practise it interactively →
Reading is only half of it. Tap through the real SPSS menus, read the output and pick the right write-up in 7 quick questions, with instant feedback on every answer.
Practice for this lesson is part of Pro, with every unit, unlimited hearts and saved progress.