Question: Limma Model Matrix Understanding
0
4.6 years ago by
United Kingdom
andrew.j.skelton73320 wrote:

Hi,

I'd just like to increase my understanding of my grouped model design.

foo <- as.factor(c("A","A","A","B","B","B"))
mod <- model.matrix(~0 + foo)
mod <- model.matrix(~1 + foo)

For the example above, I know that adding the ~1 or ~0 stops the first term of the groupings from being absorbed into the intercept, but I'm just wondering what the differences are between using 0 and 1. Does anyone have a good explanation of this?

Thanks

modified 4.6 years ago by Aaron Lun25k • written 4.6 years ago by andrew.j.skelton73320
6
4.6 years ago by
Aaron Lun25k
Cambridge, United Kingdom
Aaron Lun25k wrote:

From a practical perspective, the interpretation of your coefficients will change. In the first model with ~0, each coefficient represents the average of the samples at each level of foo, i.e., the first coefficient represents the average for A, while the second represents the average of B. In the second model, the intercept represents the average of the samples for A, while the second coefficient represents the increase in the average of B over that of A. Indeed, the systematic component for the samples in B is the sum of the first and second coefficients, while the systematic component for samples in A is just comprised of the first coefficient.

Both models are valid inputs into limma. The choice between the two depends on which one is easier to interpret. For complicated models, I like to do without the intercept as I can interpret each coefficient by itself, without having to mentally consider its meaning relative to some intercept value. However, for simple models like the one you presented above, the analysis may be easier with the intercept as you can just drop the second coefficient to get the difference between the two groups - there's no need to use contrasts.fit.