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 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/or 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 two sample distributions are normally distributed with equal variance. Welch's t-test is designed for unequal sample distribution variance, but the assumption of sample distribution 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:

where , and are the sample mean, sample standard deviation and sample size, respectively, . Unlike in Student's t-test, the denominator is not based on a pooled variance estimate.

The degrees of freedom   associated with this variance estimate is approximated using the Welch–Satterthwaite equation:

Here , the degrees of freedom associated with the first variance estimate. , the degrees of freedom associated with the 2nd variance estimate.

The statistic 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.[4][5]

Statistical test

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 rounded down to the nearest integer.

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.[2] Welch's t-test can be generalized to more than 2-samples,[6] 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.[7] 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.[8] Reliability decreases for skewed distributions and smaller samples, where one could possibly perform Welch's t-test.[9]

Examples

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 equal 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
11520.87.91523.03.8−2.46280.0210.021−2.4625.00.0210.017
21020.69.02022.10.9−2.10280.0450.150−1.579.90.1490.144
31019.41.42021.617.1−1.64280.1100.036−2.2224.50.0360.042

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.

Software implementations

Language/ProgramFunctionNotes
LibreOfficeTTEST(Data1; Data2; Mode; Type)See [10]
MATLABttest2(data1, data2, 'Vartype', 'unequal')See [11]
Microsoft Excel pre 2010TTEST(array1, array2, tails, type)See [12]
Microsoft Excel 2010 and laterT.TEST(array1, array2, tails, type)See [13]
MinitabAccess commands through menu: see [14][15]
SAS (Software)default output from proc ttest (labeled "Satterthwaite")
Pythonscipy.stats.ttest_ind(a, b, equal_var=False)See [16]
Rt.test(data1, data2, alternative="two.sided", var.equal=FALSE)See [17]
HaskellStatistics.Test.StudentT.welchTTest SamplesDiffer data1 data2See [18]
JMP Oneway( Y( YColumn), X( XColumn), Unequal Variances( 1 ) );See [19]
Julia UnequalVarianceTTest(data1, data2)See [20]
Stata ttest varname1 == varname2, welch See [21]
Google Sheets TTEST(range1, range2, tails, type) See [22]
GraphPad Prism It is a choice on the t test dialog.
IBM SPSS StatisticsAn option in the menu.[23] Cf. [24]
GNU Octave welch_test(x, y) See [25]
gollark: You should be using cooler compression algorithms like zstdandard.
gollark: Wow, nginx has many cool features I am not using.
gollark: I mean, GIFs are sort of a video format, but a really stupid one.
gollark: Video to GIF conversion is pure evil.
gollark: Here is the webm version. Ironically, the metadata on the GIF says it was made using a video to GIF converter.

See also

References

  1. 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. 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. 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. The Satterthwaite Formula for Degrees of Freedom in the Two-Sample t-Test (page 7)
  5. 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
  6. 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.
  7. Zimmerman, D. W. (2004). "A note on preliminary tests of equality of variances". British Journal of Mathematical and Statistical Psychology. 57: 173–181. doi:10.1348/000711004849222.
  8. 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.
  9. 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.
  10. https://help.libreoffice.org/Calc/Statistical_Functions_Part_Five#TTEST
  11. http://uk.mathworks.com/help/stats/ttest2.html
  12. http://office.microsoft.com/en-us/excel-help/ttest-HP005209325.aspx
  13. http://office.microsoft.com/en-us/excel-help/t-test-function-HA102753135.aspx
  14. Example of 2-Sample t - Minitab: — official documentation for Minitab version 18. Accessed 2019-01-22.
  15. Select the analysis options for 2-Sample t - Minitab: — official documentation for Minitab version 18. Accessed 2019-01-22.
  16. http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ttest_ind.html
  17. https://stat.ethz.ch/R-manual/R-devel/library/stats/html/t.test.html
  18. http://hackage.haskell.org/package/statistics-0.15.0.0/docs/Statistics-Test-StudentT.html
  19. https://www.jmp.com/support/help/
  20. http://hypothesistestsjl.readthedocs.org/en/latest/index.html
  21. http://www.stata.com/help.cgi?ttest
  22. https://support.google.com/docs/answer/6055837?hl=en
  23. Jeremy Miles <https://stats.stackexchange.com/users/17072/jeremy-miles>, Unequal variances t-test or U Mann-Whitney test?, URL (version: 2014-04-11): https://stats.stackexchange.com/q/93475
  24. — Official documentation for SPSS Statistics version 24. Accessed 2019-01-22.
  25. https://octave.sourceforge.io/statistics/function/welch_test.html
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.