Skip to content
Tutorials Center
My learning

Topics

Lesson 23 of 39 ยท Hypothesis Tests

Independent-Samples t Test in SPSS

Compare two group means in SPSS: set up Define Groups, read Levene's test, choose the equal or unequal variance row, compute Cohen's d and report the result.

The independent-samples t test compares the means of two separate groups on a scale outcome: treatment versus control, men versus women, store A versus store B. It is probably the most-run test in SPSS, and it has one trap that catches beginners: the output has two rows and you must read the right one.

Requirements

  • One scale test variable (the outcome, such as score).
  • One grouping variable with exactly two categories (group: 1 = control, 2 = treatment). Each case belongs to one group only.
  • Independent observations, roughly normal outcome within each group, and similar spread (checked by Levene's test).

Setting up the data

Data View needs one row per person with two columns: the outcome and the group code. Give the group codes value labels in Variable View so that output shows "Control" and "Treatment", not 1 and 2. If your scores sit in two separate columns (one per group), restructure the data first; SPSS cannot run this test on side-by-side columns.

Running the test

  1. Analyze > Compare Means > Independent-Samples T Test (in newer versions the menu entry is the same).
  2. Move score to Test Variable(s).
  3. Move group to Grouping Variable.
  4. Click Define Groups, choose "Use specified values", enter 1 and 2 (the codes), then Continue. Forgetting this step leaves the grouping variable as group(? ?) and OK stays greyed out.
  5. Options: 95% interval, missing values "Exclude cases analysis by analysis".
  6. OK or Paste:
Text
T-TEST GROUPS=group(1 2)
  /MISSING=ANALYSIS
  /VARIABLES=score
  /CRITERIA=CI(.95).

Reading the output

Group Statistics lists N, Mean, Std. Deviation and Std. Error Mean for each group. Compare means first; the test only tells you whether the observed difference is bigger than noise.

Independent Samples Test has two stacked rows:

Row Use when
Equal variances assumed Levene's p (Sig.) is above .05
Equal variances not assumed Levene's p is .05 or below

The left block is Levene's Test for Equality of Variances (F and Sig.). Read it first, then pick the row. The right block, t-test for Equality of Means, gives t, df, p, Mean Difference, Std. Error Difference and the 95% CI. The unequal-variances row (Welch) has a fractional df such as 17.34; that is normal.

Python Stand-in: both rows of the output

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Levene's test in SPSS is centred on the mean; scipy's default centres on the median, so the stand-in sets center="mean" to match.

Effect size

SPSS 27 and later adds an Independent Samples Effect Sizes table (Cohen's d, Hedges' g). Older versions leave it to you: d = mean difference / pooled standard deviation.

Python Stand-in: pooled SD, Cohen's d and the CI

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Direction matters: SPSS computes Group 1 minus Group 2 (the order you used in Define Groups). A negative t simply means group 1 has the lower mean.

Assumption checks

  • Normality per group: use Analyze > Descriptive Statistics > Explore, put the group in "Factor List", and tick "Normality plots with tests". See choosing the right test.
  • Outliers: boxplots from the same dialog show them as circles with case numbers.
  • Unequal group sizes with unequal variances make the Welch row essential. Many analysts report the Welch row by default.
  • If assumptions fail badly, use Mann-Whitney U.

Writing it up

"Participants in the treatment group (M = 75.5) scored higher than controls (M = 65.4), t(22) = 6.2, p < .001, d = 2.5." These come from the stand-in data above; add the SDs and use your own figures from the output. Mention which variance row you used if it was the Welch correction.

Common mistakes

  • Skipping Define Groups or entering the wrong codes (the labels, not the numbers).
  • Reading the "Equal variances assumed" row without checking Levene.
  • Running it on more than two groups; use one-way ANOVA.
  • Treating a non-significant result as proof of no difference. Look at the confidence interval.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Levene's Sig. is .02. Which row of the t table do you read?

    A significant Levene test means the variances differ, so use the Welch (not assumed) row.
  2. 2. What must the data layout look like for this test in SPSS?

    Each case is a row with its score and its group code.
  3. 3. What does a negative t usually mean?

    SPSS subtracts group 2 from group 1, so a negative sign just shows direction.
  4. 4. You have three groups. What should you not do?

    Multiple uncorrected t tests inflate the false-alarm rate; ANOVA tests all groups at once.

Summary

  • Analyze > Compare Means > Independent-Samples T Test needs a test variable and a grouping variable with Define Groups.
  • Read Levene's test first, then choose the equal or unequal variances row.
  • Report means, SDs, t(df), p, the CI of the difference and Cohen's d.
  • Use Mann-Whitney U when assumptions fail and ANOVA for three or more groups.

Next: Paired-Samples t Test