Two-Sample Hypothesis Tests, with Python

The Complete Beginner’s Guide to perform Two-Sample Hypothesis Tests (with code!)

Chao De-Yu
Level Up Coding
Published in
6 min readMay 23, 2021

--

Photo by Rohit Tandon on Unsplash

A Hypothesis Test is a statistical test that is used to test the assumption or hypothesis made and draw a conclusion about the entire population. In the previous article, I have introduced how to do one-sample hypothesis tests under different situations. In this article, I will share how hypothesis tests can extend to comparing samples from 2 populations instead of one.

The FIVE steps process of hypothesis testing is the same as one-sample hypothesis tests except for the calculation of test statistics, in summary:

  1. Define the Null Hypothesis (H₀)
  2. Define the Alternative Hypothesis (H₁)
  3. Set the Level of Significance (α)
  4. Collect data and calculate the Test Statistic
Figure 1: Test statistics depend on different situation

5. Construct the Rejection and Non-Rejection Regions and make a conclusion

A. Hypothesis tests for comparing 2 independent populations

--

--