# Welch's t test

In statistics, Welch's t-test (or Welch-Aspin Test) is a two-sample location test, and is used to check the hypothesis that two populations have equal means. Welch's t-test is an adaptation of Student's t-test, and is intended for use when the two samples have possibly unequal variances.[1] 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. Welch's t-test is an approximate solution to the Behrens–Fisher problem. It is sometimes referred to as the "Two-sample unpooled t-test for unequal variances" but "Welch's t-test" is preferred for brevity.

## Formulas

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

$t \quad = \quad {\; \overline{X}_1 - \overline{X}_2 \; \over \sqrt{ \; {s_1^2 \over N_1} \; + \; {s_2^2 \over N_2} \quad }}\,$

where $\overline{X}_{i}$, $s_{i}^{2}$ and $N_{i}$ are the $i$th sample mean, sample variance and sample size, respectively. Unlike in Student's t-test, the denominator is not based on a pooled variance estimate.

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

$\nu \quad \approx \quad {{\left( \; {s_1^2 \over N_1} \; + \; {s_2^2 \over N_2} \; \right)^2 } \over { \quad {s_1^4 \over N_1^2 \nu_1} \; + \; {s_2^4 \over N_2^2 \nu_2 } \quad }}$

Here $\nu_i$ = $N_i-1$, the degrees of freedom associated with the $i$th variance estimate.

## Statistical test

Once t and $\nu$ have been computed, these statistics can be used with the t-distribution to test the null hypothesis that the two population means are equal (using a two-tailed test), or the alternative hypothesis that one of the population means is greater than or equal to the other (using a one-tailed test). In particular, the test will yield a p-value which might or might not give evidence sufficient to reject the null hypothesis.

This method also does not give exactly the nominal rate, but is generally not too far off.[citation needed] However, if the population variances are equal, or if the samples are rather small and the population variances can be assumed to be approximately equal, it is more accurate to use Student's t-test.[2]

## Software implementations

As this is a widely used method, there are implementations in common statistical packages.

Language/Program Function Notes
Python scipy.stats.ttest_ind(a, b, axis=0, equal_var=False) See [1]
R t.test(data1, data2, alternative="two.sided", var.equal=FALSE) See [2]