Quantitative Analysis/ Compare Means
Testing group differences

How to tell if the difference between two groups is real

The independent t-test asks whether the average of a numeric outcome differs between two separate groups. This guide covers what the test does, when it is appropriate, how to read the result, and how to run it in AnalyZ Solutions.

9 min read Compare Means Beginner

01What the independent t-test does

Many questions come down to whether two groups differ on some measure. Do girls and boys score differently on a reading assessment? Do customers who joined a loyalty scheme spend more per visit than those who did not? The independent t-test answers this by comparing the two group averages while accounting for how much scores vary within each group and how many people are in each.

If the averages are far apart relative to that variation, the difference is unlikely to be a product of sampling luck. If they are close relative to the spread, the gap could easily appear by chance. The test condenses this into a t statistic and a significance level.

02When to use it

Use the independent t-test when the outcome is numeric, the data falls into exactly two groups, and each person appears in only one group. The groups must be unrelated: different respondents, not the same respondents measured twice. For measurements taken twice on the same people, use the paired t-test instead. For three or more groups, use a one-way ANOVA.

A worked example: a study records monthly income for 120 people who completed a course and 110 who did not. The average is 310 for those who completed it and 280 for those who did not. The t-test tells you whether that 30-unit gap is larger than you would expect from sampling variation alone.

03Assumptions to check

Independence. Each observation should be unrelated to the others. Respondents from the same family, or the same person appearing twice, break this.

Roughly normal outcomes within each group. With more than about 30 people per group the test is forgiving. With very small groups or heavily skewed outcomes such as income, consider the Mann-Whitney U test.

Similar spread in both groups. The test works best when the two groups vary by a similar amount. AnalyZ Solutions runs Levene's test for equal variances alongside the t-test so you can check this. If Levene's test is significant and the groups are also very different in size, treat the t-test result with caution and look at the Mann-Whitney U test as a cross-check.

04Reading the result

The significance level

If the difference is significant, the interpretation names the group with the higher average and states the level at which the difference is significant: 5%, 1%, or 0.1%. If it is not, the interpretation says there is no significant difference. A non-significant result means the data did not provide enough evidence of a difference, and it does not prove the groups are identical.

Cohen's d, the size of the gap

Cohen's d expresses the difference in average as a number of standard deviations. Values below 0.2 are negligible, 0.2 to 0.5 small, 0.5 to 0.8 medium, and above 0.8 large. In the income example, if the pooled standard deviation is 100, a 30-unit gap gives a d of 0.3, a small effect. It may still matter for policy, but it is not dramatic.

05How to run it in AnalyZ Solutions

Open Inferential Analysis, choose Compare Means, then Independent t-test.

  1. Select the dependent variable
    Pick the numeric outcome, such as income or test score.
  2. Select the grouping variable
    Pick the variable that defines the two groups. The page counts the categories for you. A green message confirms that exactly two groups were found. If it reports a different number, the test will not run, so choose a variable with exactly two values or use a filter to keep only two.
  3. Choose one-tailed or two-tailed
    Two-tailed is the default and the right choice unless you had a firm reason, set before seeing the data, to expect the difference in one direction only. In AnalyZ Solutions the one-tailed option tests only whether the first group listed is higher than the second.
  4. Running an independent t-test in AnalyZ Solutions.

  5. Apply a subsample filter if needed
    For instance, to compare men and women within one region only.
  6. Click Run
    The results show a descriptives table with the count, mean, and standard deviation for each group, a test table with the t statistic, degrees of freedom, significance, Cohen's d, and the Levene result, and a plain-language interpretation.

You can download the tables as CSV, Excel, or Word, send them to Sense Making, or add the finding to a Data Canvas slide.

Look at both group averages before reading the test. The descriptives table tells you which group is higher and by how much. The test only tells you whether the gap is unlikely to be chance, so the two pieces belong together in your write-up.

06One-tailed versus two-tailed tests

A two-tailed test looks for a difference in either direction. A one-tailed test looks in one direction only, which makes it easier to reach significance but blind to an effect the other way. In AnalyZ Solutions it tests whether the first group is higher than the second, so a lower first group gives a large p-value however big the gap. Choosing one-tailed after seeing which group happened to score higher is a form of cheating. If in doubt, keep two-tailed.

07Interpreting the result

The figures below are invented to show the steps, and they follow the results tables in AnalyZ Solutions, with a few columns left out to save space. Suppose students were taught one subject either online or in a classroom, and you compare their exam scores.

Descriptives
GroupNMeanSD
Online4271.610.4
Classroom3866.29.8
Test result
tdfp-valueSigCohen's dLevene p
2.3834780.0196*0.5340.8653

Reading it step by step

  1. Check the groups
    Both groups are reasonably large (42 and 38) and their standard deviations are close (10.4 and 9.8). Levene's p of 0.8653 gives no sign of unequal spread, so the standard t-test is appropriate.
  2. Read the direction
    The online group averaged 71.6 and the classroom group 66.2, a gap of 5.4 points in favour of online. The positive t confirms that the first group listed is the higher one.
  3. Check significance
    The p-value of 0.0196 is below 0.05 and carries one star, so the difference is significant at the 5% level. It is not significant at the 1% level, so the evidence is moderate and not overwhelming.
  4. Judge the size
    Cohen's d is 0.534, a medium effect. The gap is about half a standard deviation, which is large enough to notice in practice.

In plain words

Students in the online course scored 5.4 points higher on average than those in the classroom course (71.6 against 66.2). The difference is medium in size and significant at the 5% level, so it is unlikely to be a sampling accident. The test cannot say why the gap exists. If students chose their own format, the groups may have differed before the course began.

08Common mistakes

Using it on more than two groups. Running several t-tests across three or more groups inflates the chance of false findings. Use ANOVA and a post-hoc comparison instead.

Using it on paired data. If the same people appear in both columns, such as before and after scores, use the paired t-test.

Reading significance as importance. A large sample can make a trivial gap significant. Always check Cohen's d.

Ignoring outliers. A few extreme values can drag a group average and distort the result. Inspect the distribution with the Descriptive Analysis module first.

Frequently Asked Questions
Can the independent t-test be used with a Likert scale?
A single Likert item is ordinal, so a rank-based test such as Mann-Whitney U is the safer choice. A score built by summing or averaging several Likert items behaves much more like a continuous measure, and the t-test is generally acceptable for it, particularly with reasonable group sizes.
What does it mean if Levene's test is significant?
It suggests the two groups differ in how spread out their scores are. Where group sizes are similar the t-test is fairly resilient to this. Where the smaller group has the larger spread, or the sizes are quite unequal, the result can be unreliable and a Mann-Whitney U test is a useful cross-check.
How large should each group be?
There is no fixed minimum, but groups under about 15 make the normality assumption hard to rely on, and very unequal group sizes reduce accuracy. Larger groups give you more power to detect small differences.
My grouping variable has more than two values. What now?
Either use a one-way ANOVA to compare all the groups at once, or filter the data so only two categories remain. Merging categories is only sensible if it makes conceptual sense for your research question.
What if the result is not significant but the difference looks big?
Check the sample size and the effect size. A large but non-significant difference in a small sample often means the study lacked the power to detect it. Report the difference honestly and note that the evidence is inconclusive rather than negative.
Should I report the t statistic?
Academic papers usually do, along with the degrees of freedom. Summaries for readers outside statistics are clearer when they lead with the group averages, the effect size, and the significance level. AnalyZ Solutions provides all of these in the exported tables.

Compare two groups in your data

Open Compare Means in AnalyZ Solutions. Free to sign up, free to analyze.

Get started
Related Guides