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.

Free tutorialPro practiceAbout 5 minutes7 practice questions

Quick answer: How do you run an independent-samples t-test in SPSS?

  1. Click Analyze › Compare Means › Independent-Samples T Test.
  2. Move the outcome into Test Variable(s) and the group variable into Grouping Variable.
  3. Click Define Groups, enter the two group codes, then click OK.
  4. 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.

Last updated November 2026 · Not sure this is the right test? Try the Which statistical test? tool.

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

Independent-samples t-test

Use it when two separate groups each give one score, and you want to know whether the group means differ. Example: online vs in-person students' exam scores.

Independent-Samples T Test
Variables
Participant ID [id]
Age in years [age]
▶
Test Variable(s):1
Exam score (%) [score]
▶
Grouping Variable:2
teaching(1 2)
Define Groups…3
Options…Bootstrap…
✓Estimate effect sizes4
OKPaste5ResetCancelHelp
  1. 1
    Test Variable(s)The outcome you're comparing. It must be Scale, such as score.
  2. 2
    Grouping VariableThe variable that splits people into the two groups.
  3. 3
    Define Groups…Tells SPSS which codes to compare: type 1 for Group 1 and 2 for Group 2. Until you do, it shows teaching(? ?) and OK stays greyed out.
  4. 4
    Estimate effect sizesAvailable in SPSS 27 and later. Adds Cohen's d so you can report how big the difference is.
  5. 5
    PasteGives you the T-TEST syntax.

Reading the t-test output

You get two tables. Read them in this order and you won't pick the wrong row.

Output1 [Document1] – SPSS Statistics Viewer
FileEditViewDataTransformAnalyzeGraphsUtilitiesExtensionsWindowHelp
Output
Log
T-Test
Group Statistics
Independent Samples Test
Effect Sizes
Group Statistics
NMean1Std. Deviation
Online4871.2010.40
In person5265.8011.10
Independent Samples Test
Levene's Sig.2t4dfTwo-Sided p595% CI6
Equal variances assumed.5182.5198.0141.12 to 9.68
Equal variances not assumed32.5197.98.0141.13 to 9.67
  1. 1
    Group meansCheck which group is higher before you look at p. Here online students averaged 71.20.
  2. 2
    Levene's testChecks whether both groups have similar spread. Sig. above .05 means they do, so read the top row.
  3. 3
    Bottom rowIf Levene's Sig. were below .05, you'd read this row instead. It's Welch's t-test, which doesn't assume equal variances.
  4. 4
    t and dfReport both from the same row: t(98) = 2.51.
  5. 5
    Two-Sided pBelow .05 means the difference is statistically significant.
  6. 6
    Confidence intervalThe likely range of the true difference. If it doesn't include 0, the result is significant.

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.

More in Compare groups