In several papers I read that when analysing a variable (lets say the response to a medication) means across groups should be adjusted for confounding factors like age, gender etc. (if these groups have different characteristics, i.e. different age, gender, etc.)
Here I read that means that have been corrected for such imbalances are called adjusted means or least squares means. Adjusted means are predicted values from a multiple regression equation (hence, the name least squares means).
Could you please tell me how to calculate these adjusted means in MATLAB? Please consider that I have 4 groups and I should adjust for more than 2 factors.