# How to remove the effect of one variable by using linear model residuals

My data set has species with a number of morphological variables, including body mass:

species  mass  skull  wing
a        10     4      4
b        15     3      5
c        30     2      6
d        40     5      9


But I want to look at a PCA of my data while controlling for body mass.

Is it appropriate to conduct regression models of skull ~ body mass & wing ~ body mass and use the residuals of these models in my PCA?

• Can you elaborate why you want to 'control' for body mass before performing PCA? PCA just finds the largest variance among combinations of the input variables, so I'm having a hard time imagining the benefit of this approach. Commented Oct 5, 2018 at 0:45
• There's quite a lot of variation in my body mass measures and the PCA is driven mostly by this trait. I'm more interested in the other traits which have more ecological relevance. Commented Oct 5, 2018 at 7:02
• Why is that an issue? PCA will then find a lot of variance in the first PC. Commented Oct 5, 2018 at 9:54
• @FransRodenburg I think your comments are worth turning into an answer, even if it's a brief one.
– mkt
Commented Oct 15, 2018 at 8:47
• Absolutely, it has provided good ammunition for me to address reviewer comments Commented Oct 15, 2018 at 9:41

(Summarized from discussion in the comments.)

PCA finds the largest variance among combinations of the input variables, so I'm having a hard time imagining the benefit of this approach. Since your variable for body weight is on a different scale (about an order of magnitude greater than the other variables), you should instead consider scaling your variables, such that their variance is the same.

You mention that body weight affects each of the other variables, but this doesn't have to be a problem: The first principal component will then likely be some combination of bodyweight and the other variables, explaining the larger part of the total variance (you can confirm this by inspecting the size of the loadings for body weight in each PC). If you are not interested in body weight per se, you can look at the remaining principal components.

I'm going to assume you have several other body parts, otherwise, there's not much point to PCA.

If you do PCA on your full data set, then what is likely to happen is that the first component will be an overall body size measure. Then you can just look at your second, third etc. components and see what they are.

The issue of different scales can (as per the comments) be dealt with by scaling the variables first.

Finally, I think you might want factor analysis rather than PCA.