As every schoolchild know, you can derive the Student -test as a linear regression with a single binary predictor. How about the Welch/Satterthwaite unequal-variance -test?
We have a technique for handling linear regression with unequal variances in the responses, the ‘model-agnostic’1 or ‘model-robust’ sandwich estimator. You might wonder what happens if you use the sandwich estimator on a linear regression with a single binary predictor.
Let be binary, coded so it has zero mean (so that it’s orthogonal to the intercept) and fit a linear model with as the outcome and as the predictor:
We know is the difference in mean between the two groups. The sandwich variance estimator for is First, note that the two outer matrices are diagonal, because of the centering of , so that we need only consider the component.
We can break the inner sum into sums over the two groups. Within each group, is constant, so it can be taken out of the sum. Write , for the two values of ; for the two sample sizes; and , for the standard deviations of in the two groups. Then
Next, note that and can be determined from and : we have and , giving and , so the middle term is
In the outside of the sandwich the element is just , which is Putting these together, the variance is This is almost exactly the variance for the Welch-Satterthwaite -test, except that it uses rather than in the denominator of the individual group variances. Or, writing for the variance estimator in group using in the denominator it’s just .
So, the Welch-Satterthwaite -statistic is basically just a linear regression with a binary predictor and the sandwich variance estimator, just as Student’s -test is a linear regression with a binary predictor and the Fisher-information variance estimator.
We don’t get the degrees of freedom that way. Improving on the Normal reference distribution for -statistics with the sandwich estimator is a bit more complicated.
Nils Lid Hjort’s term for them, which I really like↩