Solved – Adjusting for confounders when comparing means with t test

confoundingspsst-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.

Best Answer

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.