This article relies on a single source. (October 2025) |
In statistical hypothesis testing, a two-sample test is a test performed on the data of two random samples, each independently obtained from a different given population. The purpose of the test is to determine whether the difference between these two populations is statistically significant. When the only knowledge of the two populations is given through the samples, two-sample hypothesis testing becomes an instance of universal hypothesis testing.
There are a large number of statistical tests that can be used in a two-sample test. Which one(s) are appropriate depend on a variety of factors, such as:
Two-sample testing does not mean that only two random variables can be used for inference (as is sometimes incorrectly assumed). Instead, it gets its name because the problem involves data from two populations, distinct from one-sample hypothesis testing in which samples from a single population are used to make a decision.
Statistical tests that may apply for two-sample testing include:
Given samples taken independently and identically distributed (iid) from a population , and taken iid from a population , the goal of a two sample test is to determine which of the two hypothesis are correct:In many instances of two-sample hypothesis testing, the only information that we have about the populations comes from the samples, meaning that any test needs to be non-parametric.
When considering tests with fixed (or vanishing) false positive rate, the best achievable exponent for the false negative rate is the log of the Bhattacharya distance or equivalently with the Renyi divergence. The first test known to achieve this optimal error exponent was based on maximum mean discrepancy.