In statistics, Welch's t-test, or unequal variances t-test, is a two-sample location test which is used to test the hypothesis that two populations have equal means. It is named for its creator, Bernard Lewis Welch, is an adaptation of Student's t-test, and is more reliable when the two samples have unequal variances and possibly unequal sample sizes. 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 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.
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. Welch's t-test is an approximate solution to the Behrens–Fisher problem.
Welch's t-test defines the statistic t by the following formula:
where and are the sample mean and its standard error, for a given sample standard deviation, , and sample size . Unlike in Student's t-test, the denominator is not based on a pooled variance estimate.
This expression can be simplified when :
Here, is the degrees of freedom associated with the i-th variance estimate.
- 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.
Advantages and limitations
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. Welch's t-test can be generalized to more than 2-samples, 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. 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. Reliability decreases for skewed distributions and smaller samples, where one could possibly perform Welch's t-test.
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|
Welch's t-test and Student's t-test gave identical results when the two samples have identical variances and sample sizes (Example 1). But note that 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.
|Microsoft Excel pre 2010 (Student's T Test)||
|Microsoft Excel 2010 and later (Student's T Test)||
|Minitab||Accessed through menu|||
|SAS (Software)||Default output from |
|Python (through 3rd-party library SciPy)||
|GraphPad Prism||It is a choice on the t test dialog.|
|IBM SPSS Statistics||An option in the menu|||
- Student's t-test
- Factorial experiment
- One-way analysis of variance
- Hotelling's two-sample T-squared statistic, a multivariate extension of Welch's t-test
- Welch, B. L. (1947). "The generalization of "Student's" problem when several different population variances are involved". Biometrika. 34 (1–2): 28–35. doi:10.1093/biomet/34.1-2.28. MR 0019277. PMID 20287819.
- Ruxton, G. D. (2006). "The unequal variance t-test is an underused alternative to Student's t-test and the Mann–Whitney U test". Behavioral Ecology. 17 (4): 688–690. doi:10.1093/beheco/ark016.
- Derrick, B; Toher, D; White, P (2016). "Why Welchs test is Type I error robust" (PDF). The Quantitative Methods for Psychology. 12 (1): 30–38. doi:10.20982/tqmp.12.1.p030.
- 7.3.1. Do two processes have the same mean?, Engineering Statistics Handbook, NIST. (Online source accessed 2021-07-30.)
- The Satterthwaite Formula for Degrees of Freedom in the Two-Sample t-Test (page 7)
- Yates, Moore, and Starnes, The Practice of Statistics, 3rd ed., p. 792. Copyright 2008 by W.H. Freeman and Company, 41 Madison Avenue, New York, NY 10010
- Welch, B. L. (1951). "On the Comparison of Several Mean Values: An Alternative Approach". Biometrika. 38 (3/4): 330–336. doi:10.2307/2332579. JSTOR 2332579.
- Zimmerman, D. W. (2004). "A note on preliminary tests of equality of variances". British Journal of Mathematical and Statistical Psychology. 57 (Pt 1): 173–181. doi:10.1348/000711004849222. PMID 15171807.
- Fagerland, M. W. (2012). "t-tests, non-parametric tests, and large studies—a paradox of statistical practice?". BMC Medical Research Methodology. 12: 78. doi:10.1186/1471-2288-12-78. PMC 3445820. PMID 22697476.
- Fagerland, M. W.; Sandvik, L. (2009). "Performance of five two-sample location tests for skewed distributions with unequal variances". Contemporary Clinical Trials. 30 (5): 490–496. doi:10.1016/j.cct.2009.06.007. PMID 19577012.
- "Statistical Functions Part Five - LibreOffice Help".
- "Two-sample t-test - MATLAB ttest2 - MathWorks United Kingdom".
- "TTEST - Excel - Microsoft Office". office.microsoft.com. Archived from the original on 2010-06-13.
- "T.TEST function".
- Overview for 2-Sample t - Minitab: — official documentation for Minitab version 18. Accessed 2020-09-19.
- "Scipy.stats.ttest_ind — SciPy v1.7.1 Manual".
- "R: Student's t-Test".
- "Welcome to Read the Docs — HypothesisTests.jl latest documentation".
- "Stata 17 help for ttest".
- "T.TEST - Docs Editors Help".
- Jeremy Miles: Unequal variances t-test or U Mann-Whitney test?, Accessed 2014-04-11
- One-Sample Test — Official documentation for SPSS Statistics version 24. Accessed 2019-01-22.
- "Function Reference: Welch_test".