Welch's t-test
Shown in the app as welch_t. Part of the method reference, under Comparing groups.
When to use
Two independent groups, continuous outcome, unequal variances (default two-group test).
What you provide
- Outcome: one numeric column.
- Group: one categorical column with exactly two groups.
Options
Missing data
- Complete case (listwise deletion)
- Mean imputation (single)
- Median imputation (single)
Multiple comparisons
- Not adjustable for this method. Where it makes post-hoc comparisons, the procedure applies its own correction.
Confidence level
Every interval in the result is reported at the level you choose:
- 90%
- 95%
- 99%
Alternative hypothesis
Two-sided unless you choose otherwise. Choose a one-sided test only when the direction was specified before the data were seen; the result then says so.
- Two-sided: the first differs from the second in either direction
- One-sided: the first is lower than the second
- One-sided: the first is higher than the second
Related methods
Alternatives that take the same inputs:
Other methods under Comparing groups:
- Paired t-test
- Wilcoxon signed-rank test
- One-way ANOVA
- Welch's ANOVA
- Kruskal-Wallis test
- Repeated-measures ANOVA (Greenhouse-Geisser)
- ANCOVA (analysis of covariance)
- Two-way ANOVA (factorial)
Guides that discuss this method
How to read the output
These methods compare one outcome between two independent groups, for example reading scores under two teaching methods, or plant height under two fertilisers.
Welch’s and Student’s t-tests. The estimate is the difference in group means, with the direction stated (first group minus second). Read it with its 95% confidence interval: the interval is the range of differences compatible with your data, and an interval that excludes 0 corresponds to p below 0.05. The p-value is the probability of a difference at least this large if the two population means were equal; it does not measure how large or important the difference is. The effect size is Cohen’s d, the mean difference in standard-deviation units. Cohen’s benchmarks of 0.2, 0.5 and 0.8 for small, medium and large are a rough guide, not a rule (Cohen, 1988).
Welch’s test does not assume equal variances, which is why it is the default. When the variances really are equal it loses very little compared with Student’s test (Delacre, Lakens and Leys, 2017).
Mann-Whitney U test. This rank test asks whether values in one group tend to be larger than values in the other. It is a test of medians only when the two distributions have the same shape. The estimate is the Hodges-Lehmann shift, the median of all differences between a value from one group and a value from the other, with its confidence interval. The effect size is the rank-biserial correlation, from -1 to 1, where 0 means neither group tends to be larger (Kerby, 2014).
Sources: Cohen J (1988), Statistical Power Analysis for the Behavioral Sciences, 2nd ed., Lawrence Erlbaum. Delacre M, Lakens D, Leys C (2017), International Review of Social Psychology 30(1):92-101, doi:10.5334/irsp.82. Kerby DS (2014), Comprehensive Psychology 3, doi:10.2466/11.IT.3.1.
Worked examples
Celeus's result on a published or illustrative dataset, next to an independent computation and, where one exists, a published value. The data themselves are not reproduced here.
datasets::ToothGrowth
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Crampton (1947), J. Nutrition 33(5)
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| p-value | 0.0606345 | 0.0606345 | - | Yes |
datasets::ToothGrowth
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Crampton (1947), J. Nutrition 33(5)
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Test statistic | 1.91527 | 1.91527 | - | Yes |
| p-value | 0.0303173 | 0.0303173 | - | Yes |
| Estimate | 3.7 | 3.7 | - | Yes |
| Degrees of freedom | 55.3094 | 55.3094 | - | Yes |
| Lower confidence limit | 0.468269 | 0.468269 | - | Yes |
| Effect size | 0.49452 | 0.49452 | - | Yes |
| Effect size lower confidence limit | 0.0610971 | 0.0610971 | - | Yes |
datasets::ToothGrowth
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Crampton (1947), J. Nutrition 33(5)
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Test statistic | 1.91527 | 1.91527 | - | Yes |
| p-value | 0.0606345 | 0.0606345 | - | Yes |
| Estimate | 3.7 | 3.7 | - | Yes |
| Degrees of freedom | 55.3094 | 55.3094 | - | Yes |
| Confidence interval | 0.468269, 6.931730 | 0.468269, 6.931730 | - | Yes |
datasets::mtcars (am coded 0/1)
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Henderson & Velleman (1981), Biometrics 37(2)
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Test statistic | -3.76712 | -3.76712 | - | Yes |
| p-value | 0.00137364 | 0.00137364 | - | Yes |
| Estimate | -7.24494 | -7.24494 | - | Yes |
| Degrees of freedom | 18.3323 | 18.3323 | - | Yes |
| Confidence interval | -11.28020, -3.20968 | -11.28020, -3.20968 | - | Yes |
ggplot2::diamonds (Ideal vs Premium cut)
- Source: Published dataset distributed with an R package
- Licence: ggplot2 (MIT)
- Reference: ggplot2 package data (Wickham 2016)
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Test statistic | -24.9179 | -24.9179 | - | Yes |
| p-value | 1.7189e-135 | 1.7189e-135 | - | Yes |
| Estimate | -1126.72 | -1126.72 | - | Yes |
| Degrees of freedom | 26552.2 | 26552.2 | - | Yes |
| Confidence interval | -1215.34, -1038.09 | -1215.34, -1038.09 | - | Yes |
References
- Welch, B. L. (1947). The generalization of Student's problem when several different population variances are involved. Biometrika 34: 28-35. doi:10.1093/biomet/34.1-2.28 doi:10.1093/biomet/34.1-2.28
- Delacre, M., Lakens, D., Leys, C. (2017). Why psychologists should by default use Welch's t-test instead of Student's t-test. International Review of Social Psychology 30: 92-101. doi:10.5334/irsp.82 doi:10.5334/irsp.82