Statistical test of whether two populations have equal means
Instatistics, Welch's t-test, or unequal variances t-test, is a two-sample location test which is used to test the (null) hypothesis that two populations have equal means. It is named for its creator, Bernard Lewis Welch, and is an adaptation of Student's t-test,[1] and is more reliable when the two samples have unequal variances and possibly unequal sample sizes.[2][3] These tests are often referred to as "unpaired" or "independent samples" t-tests, as they are typically applied when the statistical units underlying the two samples being compared are non-overlapping. Given that Welch's t-test has been less popular than Student's t-test[2] and may be less familiar to readers, a more informative name is "Welch's unequal variances t-test" — or "unequal variances t-test" for brevity.[3]
Student's t-test assumes that the sample means being compared for two populations are normally distributed, and that the populations have equal variances. Welch's t-test is designed for unequal population variances, but the assumption of normality is maintained.[1] Welch's t-test is an approximate solution to the Behrens–Fisher problem.
Here, is the degrees of freedom associated with the i-th variance estimate.
The statistic is approximately from the t-distribution since we have an approximation of the chi-square distribution. This approximation is better done when both and are larger than 5.[5][6]
Once t and have been computed, these statistics can be used with the t-distribution to test one of two possible null hypotheses:
that the two population means are equal, in which a two-tailed test is applied; or
that one of the population means is greater than or equal to the other, in which a one-tailed test is applied.
The approximate degrees of freedom are real numbers and used as such in statistics-oriented software, whereas they are rounded down to the nearest integer in spreadsheets.
Welch's t-test is more robust than Student's t-test and maintains type I error rates close to nominal for unequal variances and for unequal sample sizes under normality. Furthermore, the power of Welch's t-test comes close to that of Student's t-test, even when the population variances are equal and sample sizes are balanced.[2] Welch's t-test can be generalized to more than 2-samples,[7] which is more robust than one-way analysis of variance (ANOVA).
It is not recommended to pre-test for equal variances and then choose between Student's t-test or Welch's t-test.[8] Rather, Welch's t-test can be applied directly and without any substantial disadvantages to Student's t-test as noted above. Welch's t-test remains robust for skewed distributions and large sample sizes.[9] Reliability decreases for skewed distributions and smaller samples, where one could possibly perform Welch's t-test.[10]
The following three examples compare Welch's t-test and Student's t-test. Samples are from random normal distributions using the R programming language.
For all three examples, the population means were and .
The first example is for unequal but near variances (, ) and equal sample sizes (). Let A1 and A2 denote two random samples:
The second example is for unequal variances (, ) and unequal sample sizes (, ). The smaller sample has the larger variance:
The third example is for unequal variances (, ) and unequal sample sizes (, ). The larger sample has the larger variance:
Reference p-values were obtained by simulating the distributions of the t statistics for the null hypothesis of equal population means (). Results are summarised in the table below, with two-tailed p-values:
Sample A1
Sample A2
Student's t-test
Welch's t-test
Example
1
15
20.8
7.9
15
23.0
3.8
−2.46
28
0.021
0.021
−2.46
24.9
0.021
0.017
2
10
20.6
9.0
20
22.1
0.9
−2.10
28
0.045
0.150
−1.57
9.9
0.149
0.144
3
10
19.4
1.4
20
21.6
17.1
−1.64
28
0.110
0.036
−2.22
24.5
0.036
0.042
Welch's t-test and Student's t-test gave identical results when the two samples have similar variances and sample sizes (Example 1). But note that even if you sample data from populations with identical variances, the sample variances will differ, as will the results of the two t-tests. So with actual data, the two tests will almost always give somewhat different results.
For unequal variances, Student's t-test gave a low p-value when the smaller sample had a larger variance (Example 2) and a high p-value when the larger sample had a larger variance (Example 3). For unequal variances, Welch's t-test gave p-values close to simulated p-values.
Results of the Welch t-test are automatically outputted in the result sheet when conducting a two-sample t-test (Statistics: Hypothesis Testing: Two-Sample t-test)
^Yates; Moore; Starnes (2008). The Practice of Statistics (3rd ed.). New York: W.H. Freeman and Company. p. 792. ISBN9780716773092.
^Welch, B. L. (1951). "On the Comparison of Several Mean Values: An Alternative Approach". Biometrika. 38 (3/4): 330–336. doi:10.2307/2332579. JSTOR2332579.