Question: Extracting results of three factor analysis with DESEQ2
gravatar for gw.sarah
2.8 years ago by
United States
gw.sarah0 wrote:


I have a dataset with three factors that each have two levels.  I would like to run the full model:

~ factorA*factorB*factorC

and use the Wald test for significance, but I am having trouble interpreting the results. 

I understand from the manual section 3.3 that for a standard model matrix (and since my factors only have two levels, I believe this is correct), if I had two factors factorA and factorB, I would use the following code to extract results:

results(dds, contrast=c("factorA","level1","level2"))

to get the effect of factor A for the reference level of factorB. 


My first question is, if I have three factors, would the same code give me the effect of factorA for the reference levels of both factorB and factorC?

If this is true, how do I get the effect of factorA on the other combinations of levels of factorB and factorC?

I understand that to get the effect of factor A in the other level of factorB for two factors, I should use the following:

results(dds, contrast=list(c("factorAlevel2","factorBlevel2.factorAlevel2")))

If , in my three factor model, this is giving me the effect of factor A on factor B level 2 and factor C level 1, how do I get the effect of factorA on factor B level2 and factor C level 2?

Or, is there a better way to get the main effects when I have a three factor model?

Thanks for any help!


Sarah GW

PhD. Candidate

Northeastern University Marine Science Center


ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by gw.sarah0
gravatar for Michael Love
2.8 years ago by
Michael Love18k
United States
Michael Love18k wrote:

hi Sarah,

See if you can get all the comparisons you want by following this recommendation:

A: DESEq2 comparison with mulitple cell types under 2 conditions

You would combine all three factors into one factor, using paste0() and factor(), and then use that as the single variable in the design.


ADD COMMENTlink written 2.8 years ago by Michael Love18k

Ok great, thanks for the help! That makes sense for getting the three-way interaction effects, but if my model is simply ~group, how do I get the main effects for each factor?  Would it be legitimate to do:

~ FactorA + FactorB + FactorC + group ?





ADD REPLYlink written 2.8 years ago by gw.sarah0

My suggestion (the link) is for comparing distinct combinations of A, B and C. You would just use a design of ~group and then pick pairs which you want to compare with 'contrast'.

There are many other comparisons to be made with ~A*B*C. If you use this design, you should use: DESeq(dds, betaPrior=FALSE). (this will happen automatically in the October release: designs with interaction terms will turn off the beta prior). You can extract any number of contrasts afterward, see the help for ?results. For the interpretation of each kind of contrast, I would consult a local statistician at your institute. This is more of an interpretation question than a software question, and there will be nothing special about the DESeq2 coefficients (they will be the same as produced by a normal linear regression model).

ADD REPLYlink written 2.8 years ago by Michael Love18k

Hi Dr. Love,

Thanks for the help, I don't think my question was clear enough.  If I run a normal linear regression model ~A*B*C, the output i get is a table with the main effect of each factor, as well as the interactions (2 and 3-way).  I am having a hard time getting a similar output from DESeq, specifically, according to the manual, for standard model matrices, I can only get the effect of each condition in the reference levels in the other sets.  For the model ~A*B*C, how do I get the main effects of each factor and pairwise interactions from DESeq?  Does that make sense?




ADD REPLYlink written 2.8 years ago by gw.sarah0

You can use DESeq2 to test individual terms or contrasts of terms with a Wald test, or you can perform likelihood ratio tests comparing nested models. If you are referring to the anova table for a regular linear model, you would have to perform multiple likelihood ratio tests comparing models with increasing number of terms. We do not have a single function like anova that will order the models and make an Analysis of Deviance table. Note that you can provide matrices to 'full' and 'reduced' as well, if that is easier than providing formula.

ADD REPLYlink modified 2.8 years ago • written 2.8 years ago by Michael Love18k

Okay! Thanks!

ADD REPLYlink written 2.8 years ago by gw.sarah0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 174 users visited in the last hour