# Welch's t-test

(Redirected from Welch's t test)

In statistics, 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]

## Assumptions

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.

## Calculations

Welch's t-test defines the statistic t by the following formula:

${\displaystyle t={\frac {\Delta {\overline {X}}}{s_{\Delta {\bar {X}}}}}={\frac {{\overline {X}}_{1}-{\overline {X}}_{2}}{\sqrt {{s_{{\bar {X}}_{1}}^{2}}+{s_{{\bar {X}}_{2}}^{2}}}}}\,}$
${\displaystyle s_{{\bar {X}}_{i}}={s_{i} \over {\sqrt {N_{i}}}}\,}$

where ${\displaystyle {\overline {X}}_{i}}$ and ${\displaystyle s_{{\bar {X}}_{i}}}$ are the ${\displaystyle i^{\text{th}}}$ sample mean and its standard error, with ${\displaystyle s_{i}}$ denoting the corrected sample standard deviation, and sample size ${\displaystyle N_{i}}$. Unlike in Student's t-test, the denominator is not based on a pooled variance estimate.

The degrees of freedom ${\displaystyle \nu }$  associated with this variance estimate is approximated using the Welch–Satterthwaite equation:[4]

${\displaystyle \nu \quad \approx \quad {\frac {\left(\;{\frac {s_{1}^{2}}{N_{1}}}\;+\;{\frac {s_{2}^{2}}{N_{2}}}\;\right)^{2}}{\quad {\frac {s_{1}^{4}}{N_{1}^{2}\nu _{1}}}\;+\;{\frac {s_{2}^{4}}{N_{2}^{2}\nu _{2}}}\quad }}.}$

This expression can be simplified when ${\displaystyle N_{1}=N_{2}}$:

${\displaystyle \nu \approx {\frac {s_{\Delta {\bar {X}}}^{4}}{\nu _{1}^{-1}s_{{\bar {X}}_{1}}^{4}+\nu _{2}^{-1}s_{{\bar {X}}_{2}}^{4}}}.}$

Here, ${\displaystyle \nu _{i}=N_{i}-1}$ 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 ${\displaystyle N_{1}}$ and ${\displaystyle N_{2}}$ are larger than 5.[5][6]

## Statistical test

Once t and ${\displaystyle \nu }$ 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 ${\displaystyle \left(\nu \in \mathbb {R} ^{+}\right)}$ 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]

## Software implementations

Language/Program Function Documentation
LibreOffice TTEST(Data1; Data2; Mode; Type) [11]
MATLAB ttest2(data1, data2, 'Vartype', 'unequal') [12]
Microsoft Excel pre 2010 (Student's T Test) TTEST(array1, array2, tails, type) [13]
Microsoft Excel 2010 and later (Student's T Test) T.TEST(array1, array2, tails, type) [14]
Origin software 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) [16]
SAS (Software) Default output from proc ttest (labeled "Satterthwaite")
Python (through 3rd-party library SciPy) scipy.stats.ttest_ind(a, b, equal_var=False) [17]
R t.test(data1, data2, var.equal = FALSE) [18]
JavaScript ttest2(data1, data2) [19]
Haskell Statistics.Test.StudentT.welchTTest SamplesDiffer data1 data2 [20]
JMP  Oneway( Y( YColumn), X( XColumn), Unequal Variances( 1 ) ); [21]
Julia  UnequalVarianceTTest(data1, data2) [22]
Stata ttest varname1 == varname2, welch [23]
Google Sheets TTEST(range1, range2, tails, type) [24]
GraphPad Prism It is a choice on the t test dialog.
IBM SPSS Statistics An option in the menu [25][26]
GNU Octave welch_test(x, y) [27]

## References

1. ^ a b 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.
2. ^ a b c 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.
3. ^ a b 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.
4. ^ 7.3.1. Do two processes have the same mean?, Engineering Statistics Handbook, NIST. (Online source accessed 2021-07-30.)
5. ^ Allwood, Michael (2008). "The Satterthwaite Formula for Degrees of Freedom in the Two-Sample t-Test" (PDF). p. 6.
6. ^ Yates; Moore; Starnes (2008). The Practice of Statistics (3rd ed.). New York: W.H. Freeman and Company. p. 792. ISBN 9780716773092.
7. ^ 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.
8. ^ 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.
9. ^ 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.
10. ^ 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.
11. ^
12. ^
13. ^ "TTEST - Excel - Microsoft Office". office.microsoft.com. Archived from the original on 2010-06-13.
14. ^
15. ^ Overview for 2-Sample t - Minitab: — official documentation for Minitab version 18. Accessed 2020-09-19.
16. ^ "Help Online - Quick Help - FAQ-314 Does Origin supports Welch's t-test?". www.originlab.com. Retrieved 2023-11-09.
17. ^
18. ^
19. ^
20. ^
21. ^
22. ^
23. ^
24. ^
25. ^ Jeremy Miles: Unequal variances t-test or U Mann-Whitney test?, Accessed 2014-04-11
26. ^ One-Sample Test — Official documentation for SPSS Statistics version 24. Accessed 2019-01-22.
27. ^