# Adjusting for confounders when comparing means with t test

In an article I found recently they were able to compute the difference in means of two groups (presumably with a t-test) while adjusting for confounders; they called this the aDiff (adjusted difference).

Now I understand that you can use linear regression for continuous variables when you want to adjust for confounders, but with linear regression you are not comparing means.

-
No reason to label this as to do with SPSS. It's a general statistical question. And to give a concise comment, linear regression is precisely about comparing means and at its simplest the t test just is a special case of regression. So it's not clear quite what you are asking. – Nick Cox Jan 28 at 13:13
In that case you just answered my question, now I know what I am looking for on the internet. Thanks! – Boudewijn Jan 28 at 13:23

Independent t-test is just a special case of linear regression. Given an outcome y and a binary indicator d, where d=0 for group A and d=1 for group B:

$y = \beta_0 + \beta_1 d$

The intercept $\beta_0$ is the mean of group A, the combined term $\beta_0 + \beta_1$ is the mean of group B. The p-value for $\beta_1$ then tests if the difference is different from zero. You'll see the p-value of this regression is identical to the p-value of the t-test variant.

Now, to adjust the mean for another covariate, x, the model simply becomes:

$y = \beta_0 + \beta_1 d + \beta_2x$

Now, $\beta_1$ is the so-called adjusted difference between groups A and B.

-