Statistical Methods Atlas
Atlas › Compare Groups › Independent-Samples t-Test

Independent-Samples t-Test

Tests whether the means of two independent groups differ on a continuous outcome — e.g., do male and female employees differ in job satisfaction?

Compare GroupsBivariate also known as: Two-sample t-test, Student's t-test, Unpaired t-test

✓ When to use

  • You have exactly two independent groups (different people in each group), e.g., public vs private sector employees.
  • The outcome is measured on a continuous (interval/ratio) scale, such as a job satisfaction score.
  • You want to know whether the difference between the two group means is larger than chance would produce.
  • Group sizes are reasonably large or the outcome is approximately normally distributed in each group.

✗ When NOT to use

  • The same participants are measured twice (before/after) — use the Paired t-Test instead.
  • You have three or more groups — use One-Way ANOVA; running multiple t-tests inflates Type I error.
  • The outcome is ordinal (e.g., a single 5-point item) or clearly non-normal with a small sample — use Mann–Whitney U.
  • Group variances are clearly unequal (Levene's test significant) — use the Welch t-Test.
  • The outcome is categorical (yes/no) — use a Chi-Square Test of Independence or logistic regression.

Data requirements

Dependent / outcome variableOne continuous variable (interval or ratio), e.g., a mean scale score for job satisfaction.
Independent / grouping variableOne categorical variable with exactly two independent levels, e.g., sector (public / private).
DesignBetween-subjects: each participant appears in only one group, and observations are independent of each other.
Sample size guidanceRoughly 20–30 per group gives reasonable robustness to non-normality; use G*Power for an a-priori calculation (e.g., detecting d = 0.50 at power .80, α = .05 requires ≈ 64 per group).

Assumptions

Hypotheses

H₀ — The population means of the two groups are equal (μ₁ = μ₂); any observed difference is due to sampling error.
H₁ — The population means of the two groups are not equal (μ₁ ≠ μ₂). (One-tailed: μ₁ > μ₂ or μ₁ < μ₂, only when direction was predicted in advance.)

The concept

The test computes a t statistic: the difference between the two sample means divided by the standard error of that difference. Intuitively, it asks how many 'standard errors of the difference' apart the two means are. If the groups truly came from the same population, t values near zero are common and large values are rare.

The resulting t is compared against the t distribution with (n₁ + n₂ − 2) degrees of freedom to obtain a p-value — the probability of observing a difference this large (or larger) if H₀ were true. Because statistical significance says nothing about practical importance, always pair the p-value with an effect size: Cohen's d expresses the mean difference in standard-deviation units (≈ 0.20 small, 0.50 medium, 0.80 large).

Worked example

A researcher asks whether work-from-home (n = 62) and in-office (n = 58) employees differ in job satisfaction, measured with a 5-item Likert-type scale (1–5, averaged). Mean satisfaction is 3.92 (SD = 0.61) for remote employees and 3.64 (SD = 0.66) for office employees.

Levene's test is non-significant (variances equal), normality is acceptable, so the standard independent t-test applies. The result: t(118) = 2.41, p = .017, d = 0.44 — remote employees report significantly higher satisfaction, a small-to-medium effect.

How to run it

# outcome: satisfaction (numeric), group: workmode (factor: Remote/Office)
library(effectsize)

# 1. Descriptives by group
aggregate(satisfaction ~ workmode, data = df, FUN = function(x) c(M = mean(x), SD = sd(x)))

# 2. Check assumptions
shapiro.test(df$satisfaction[df$workmode == "Remote"])
shapiro.test(df$satisfaction[df$workmode == "Office"])
car::leveneTest(satisfaction ~ workmode, data = df)

# 3. The test (var.equal = TRUE for classic Student's t)
t.test(satisfaction ~ workmode, data = df, var.equal = TRUE)

# 4. Effect size
cohens_d(satisfaction ~ workmode, data = df)

Interpreting the output

APA-style reporting

An independent-samples t-test showed that remote employees (M = 3.92, SD = 0.61) reported significantly higher job satisfaction than office employees (M = 3.64, SD = 0.66), t(118) = 2.41, p = .017, 95% CI of the difference [0.05, 0.51], d = 0.44.

Common mistakes

Related methods

Welch's t-TestWhen variances are unequalPaired-Samples t-TestSame participants measured twiceMann–Whitney U TestNon-parametric alternativeOne-Way ANOVAThree or more groupsLevene's TestCheck equal variances firstShapiro–Wilk TestCheck normality first
One-Sample t-Test →