Solved – Controlling for confounders with continuous outcome variable and categorical predictor variable

anovaconfoundingt-test

I have data on hair growth per month (continuous outcome variable) and want to compare two groups of subjects (categorical predictor: high and low intake of a compound) and include confounders into the analysis.

To just compare the two groups, I believe I can use a two-sample t-test or a one-way anova. However, there are a lot of confounders which can affect hair growth, such as age, nutrition, smoking, etc. What test can I use to include these into my analysis? I know that for two continuous variables you can use a multiple linear regression model, however what would you choose for a continuous outcome variable and a categorical predictor variable? The confounders are a mix of continuous and categorical variables.

In similar posts I have seen people suggest linear regression and two-way anova. However I thought that linear regression was only for continuous variables and a two-way anova only takes two independent variables into account? Another poster said something about 'removing the effects manually'. I wonder what that actually means (unfortunately there were no answers to the post).

I am quite new to statistics, so explanations to any answers would be greatly appreciated.

Best Answer

You could use linear regression. t-tests and anova are simply special cases of the general linear regression model.

You say: " However I thought that linear regression was only for continuous variables .... ". That is not right, you can include categorical predictors, you must just code them correctly, using dummy variables. If you do not know what that means, you can read about them in various posts here.

For instance, the post Coding categorical variables for regression have examples, and there are many others. Just use site search!