Limma Model Matrix Understanding
1
1
Entering edit mode
@andrewjskelton73-7074
Last seen 8 months ago
United Kingdom

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

limma limma design matrix model matrix • 5.7k views
ADD COMMENT
0
Entering edit mode

Actually adding ~1 to the model doesn't do anything. It just adds an intercept to a model that already has one, and so has no effect. You might have intended to write ~-1, which has the same effect as ~0.

ADD REPLY
8
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 12 hours ago
The city by the bay

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.

ADD COMMENT

Login before adding your answer.

Traffic: 943 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6