Course contentsShow
← Data Science
Lesson 359 of 2,14510. Hypothesis Tests for MeansFree lesson

Two-Sample t-Test Overview

Learn when to use two-sample t-tests to compare means from two independent groups.

Two-Sample t-Test Overview

What you'll learn: You'll discover when and why to use a two-sample t-test to compare the means of two independent groups.

What Is a Two-Sample t-Test?

A two-sample t-test (also called an independent samples t-test) determines whether the means of two separate, unrelated groups differ significantly. Unlike the one-sample t-test that compares one group to a known value, this test compares two groups to each other.

Think of it like comparing average test scores between students taught with Method A versus Method B. The students in each group are different people—they're independent.

When to Use It

Use a two-sample t-test when:

  • You have two independent groups (not the same subjects measured twice)
  • You want to compare their means
  • Your outcome variable is continuous (numerical)
  • You're asking: "Do these two groups have different average values?"

Examples:

  • Comparing average blood pressure between a treatment group and a control group
  • Testing if men and women have different average salaries in a company
  • Determining if customers from two regions spend different amounts on average

The Core Question

The two-sample t-test asks: "Is the difference between these two group means large enough that it's unlikely due to random chance alone?"

Just like the one-sample t-test, you'll set up null and alternative hypotheses, calculate a t-statistic, find a p-value, and make a decision using your significance level (α).

Independent vs Paired

The key word is independent. The observations in Group 1 have no special connection to observations in Group 2. If your data involves the same subjects measured twice (before/after), you'd use a paired test instead—but that's different from what we're covering here.

Key Takeaway: Use a two-sample t-test to compare means between two independent, unrelated groups when you want to know if their populations differ significantly.