Welch's t-test

From testwiki
Jump to navigation Jump to search

Template:Short description

Welch's t-test, or unequal variances t-test in statistics 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] Sometimes, it is referred as Satterthwaite or Welch–Satterthwaite test.

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:

t=ΔX‾sΔX¯=X‾1−X‾2sX¯12+sX¯22,
sX¯i=siNi,

where X‾i and sX¯i are the i-th sample mean and its standard error, with si denoting the corrected sample standard deviation, and sample size Ni. 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:[4]

ν≈(s12N1+s22N2)2s14N12ν1+s24N22ν2=sΔX¯4sX¯14ν1+sX¯24ν2,

where νi=Ni−1 is the degrees of freedom associated with the i-th variance estimate.

This expression can be simplified when N1=N2:

ν≈ν′sΔX¯4sX¯14+sX¯24,

where ν′=ν1=ν2=N1−1=N2−1 is the degrees of freedom associated with each 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 N1 and N2 are larger than 5.[5][6]

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:

  • A two-tailed test, in which the two population means are equal; or
  • A one-tailed test, in which one of the population means is greater than or equal to the other.

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.

Confidence intervals

Based on Welch's t-test, it's possible to also construct a two sided confidence interval for the difference in means (while not having to assume equal variances). This will be by taking:

CI(μ1−μ2):X‾1−X‾2±sX¯12+sX¯22×tν,1−α/2

Based on the above definitions of sX¯i and ν.

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,[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]

Resampling-based versions

A permutation and bootstrapped version of the Welch t-test has also been developed to address distributional requirements without relying on large sample sizes. The Welch t statistic additionally satisfies the requirement for exchangeable samples under permutation testing in the presence of unequal variances - an instance of the Behrens–Fisher problem. This approach has been extensively discussed in the statistical literature.[11][12][13][14][15][16][17]

Software implementations

Language/Program Function Documentation
LibreOffice TTEST(Data1; Data2; Mode; Type) with Type = 3 [18]
MATLAB (with Statistics and Machine Learning Toolbox) ttest2(data1, data2, 'Vartype', 'unequal') [19]
Microsoft Excel pre 2010 TTEST(array1, array2, tails, type) with type = 3 [20]
Microsoft Excel 2010 and later T.TEST(array1, array2, tails, type) with type = 3 [21]
Minitab Accessed through menu [22]
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) [23]
SAS (Software) Default output from proc ttest (labeled "Satterthwaite")
Perl t_test( $arr1, $arr2, var_equal => 0) [24]
Python (through 3rd-party library SciPy) scipy.stats.ttest_ind(a, b, equal_var=False) [25]
R t.test(data1, data2) [26]
JavaScript ttest2(data1, data2) [27]
Haskell Statistics.Test.StudentT.welchTTest SamplesDiffer data1 data2 [28]
JMP Oneway( Y( YColumn), X( XColumn), Unequal Variances( 1 ) ); [29]
Julia UnequalVarianceTTest(data1, data2) [30]
Stata ttest varname1 == varname2, welch [31]
Google Sheets TTEST(range1, range2, tails, type) with type = 3 [32]
GraphPad Prism It is a choice on the t test dialog.
IBM SPSS Statistics An option in the menu [33][34]
GNU Octave welch_test(x, y) [35]

Implementations of resampling-based variants of the Welch t-test are available in R, including permutation procedures in the MKinfer (perm.t.test) and nptest (np.loc.test) packages, as well as a bootstrap version in MKinfer (boot.t.test).[36][37]

See also

Template:Portal

References

Template:Reflist