limma 3-way interaction
1
0
Entering edit mode
@jacob-michaelson-1079
Last seen 10.2 years ago
Hi all, A while back I found some great code on the list to test for a two-way interaction in limma: > If you only want F-tests for interactions, the following code would work: > > X <- model.matrix(~a*b) > fit <- lmFit(eset, X) > p <- ncol(X) > cont.ia <- diag(p)[,attr(X,"assign")==3] > fit.ia <- eBayes(contrasts.fit(fit, cont.ia)) > > Now fit.ia contains the F-statistic and p-values for the interaction in > fit.ia$F and fit.ia$F.p.value. > This code has worked very well for me. I hand-coded an interaction using contrasts and got the exact same results as with using the above code - which was encouraging. How could this code be adapted for a three-way interaction, ie: X=model.matrix(~a*b*c) Is it safe to just to substitute this line? Any help much appreciated! --Jake
safe safe • 1.2k views
ADD COMMENT
0
Entering edit mode
@jacob-michaelson-1079
Last seen 10.2 years ago
Okay I think I get it now. I couldn't figure out what the "assign" part was for. It refers to the term in the expanded formula which led to the term(s) you're interested in, for example: a*b -> Y = int + a + b + ab 0 1 2 3 hence the line cont.ia <- diag(p)[,attr(X,"assign")==3] so for a three-way interaction it would be: a*b*c -> Y = int + a + b + c + ab + ac + bc + abc 0 1 2 3 4 5 6 7 so the line would change to cont.ia <- diag(p)[,attr(X,"assign")==7] Am I interpreting this right? --Jake On Thu, 2006-05-18 at 09:22 -0600, Jake wrote: > Hi all, > > A while back I found some great code on the list to test for a two- way > interaction in limma: > > > If you only want F-tests for interactions, the following code would > work: > > > > X <- model.matrix(~a*b) > > fit <- lmFit(eset, X) > > p <- ncol(X) > > cont.ia <- diag(p)[,attr(X,"assign")==3] > > fit.ia <- eBayes(contrasts.fit(fit, cont.ia)) > > > > Now fit.ia contains the F-statistic and p-values for the interaction > in > > fit.ia$F and fit.ia$F.p.value. > > > > This code has worked very well for me. I hand-coded an interaction > using contrasts and got the exact same results as with using the above > code - which was encouraging. > > How could this code be adapted for a three-way interaction, ie: > > X=model.matrix(~a*b*c) > > Is it safe to just to substitute this line? > > Any help much appreciated! > > --Jake > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT

Login before adding your answer.

Traffic: 919 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