limma: one sample t-test + covariate
1
0
Entering edit mode
Guido Hooiveld ★ 3.9k
@guido-hooiveld-2020
Last seen 2 hours ago
Wageningen University, Wageningen, the …
Hi, Maybe a naive question, but is it possible to do a 'one sample t-test' in limma while including a covariate in the model? If so, how? I have an experiment in which 32 volunteers were profiled on array after and before a (short-term) intervention (physical exercise). Some volunteers used a supplement, others not. I would like to identify genes responding to the intervention, while correcting for supplement use. I manually subtracted the 'before' from the 'after' expression data, so I got delta values (delta.data; a matrix). Then I checked for differential gene expression using the one sample t-test approach to check whether differences are significant from 0 (thus without defining a design using contrast.matrix). > fit <- lmFit(delta.data) > fit2 <- eBayes(fit) > topTable(fit2) ID logFC t P.Value adj.P.Val B 4426 xxx 0.4229133 9.496956 3.149698e-12 5.193054e-08 17.34925 14955 yyy 0.4817134 9.314950 5.598957e-12 5.193054e-08 16.82030 So far so good, but how can I include the covariate 'supplement' [being 0 or 1 for 38ppl] in the model? If I try to do this the usual way by defining the design using contrast.matrix, a got an error: > design <- model.matrix(~0+Intervention+Supplement) Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels The error is obviously correct because 'Intervention' is 1 for all samples. Thanks, Guido --------------------------------------------------------- Guido Hooiveld, PhD Nutrition, Metabolism & Genomics Group Division of Human Nutrition Wageningen University Biotechnion, Bomenweg 2 NL-6703 HD Wageningen the Netherlands tel: (+)31 317 485788 fax: (+)31 317 483342 email: guido.hooiveld@wur.nl internet: http://nutrigene.4t.com http://scholar.google.com/citations?user=qFHaMnoAAAAJ http://www.researcherid.com/rid/F-4912-2010 [[alternative HTML version deleted]]
limma limma • 2.6k views
ADD COMMENT
0
Entering edit mode
Guido Hooiveld ★ 3.9k
@guido-hooiveld-2020
Last seen 2 hours ago
Wageningen University, Wageningen, the …
Hi, Maybe a naive question, but is it possible to do a 'one sample t-test' in limma while including a covariate in the model? If so, how? I have an experiment in which 32 volunteers were profiled on array after and before a (short-term) intervention (physical exercise). Some volunteers used a supplement, others not. I would like to identify genes responding to the intervention, while correcting for supplement use. I manually subtracted the 'before' from the 'after' expression data, so I got delta values (delta.data; a matrix). Then I checked for differential gene expression using the one sample t-test approach to check whether differences are significant from 0 (thus without defining a design using contrast.matrix). > fit <- lmFit(delta.data) > fit2 <- eBayes(fit) > topTable(fit2) ID logFC t P.Value adj.P.Val B 4426 xxx 0.4229133 9.496956 3.149698e-12 5.193054e-08 17.34925 14955 yyy 0.4817134 9.314950 5.598957e-12 5.193054e-08 16.82030 So far so good, but how can I include the covariate 'supplement' [being 0 or 1 for 38ppl] in the model? If I try to do this the usual way by defining the design using contrast.matrix, a got an error: > design <- model.matrix(~0+Intervention+Supplement) Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels The error is obviously correct because 'Intervention' is 1 for all samples. Thanks, Guido --------------------------------------------------------- Guido Hooiveld, PhD Nutrition, Metabolism & Genomics Group Division of Human Nutrition Wageningen University Biotechnion, Bomenweg 2 NL-6703 HD Wageningen the Netherlands tel: (+)31 317 485788 fax: (+)31 317 483342 email: guido.hooiveld@wur.nl<mailto:guido.hooiveld@wur.nl> internet: http://nutrigene.4t.com http://scholar.google.com/citations?user=qFHaMnoAAAAJ http://www.researcherid.com/rid/F-4912-2010 [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
Hi Guido, On 7/10/2013 2:38 AM, Hooiveld, Guido wrote: > Hi, > Maybe a naive question, but is it possible to do a 'one sample t-test' in limma while including a covariate in the model? If so, how? > > I have an experiment in which 32 volunteers were profiled on array after and before a (short-term) intervention (physical exercise). Some volunteers used a supplement, others not. > I would like to identify genes responding to the intervention, while correcting for supplement use. > > I manually subtracted the 'before' from the 'after' expression data, so I got delta values (delta.data; a matrix). > Then I checked for differential gene expression using the one sample t-test approach to check whether differences are significant from 0 (thus without defining a design using contrast.matrix). > >> fit<- lmFit(delta.data) >> fit2<- eBayes(fit) >> topTable(fit2) > ID logFC t P.Value adj.P.Val B > 4426 xxx 0.4229133 9.496956 3.149698e-12 5.193054e-08 17.34925 > 14955 yyy 0.4817134 9.314950 5.598957e-12 5.193054e-08 16.82030 > > So far so good, but how can I include the covariate 'supplement' [being 0 or 1 for 38ppl] in the model? > > If I try to do this the usual way by defining the design using contrast.matrix, a got an error: > >> design<- model.matrix(~0+Intervention+Supplement) > Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : > contrasts can be applied only to factors with 2 or more levels > > The error is obviously correct because 'Intervention' is 1 for all samples. Right. So why are you adding intervention into your model matrix when you have already paired manually? That would be doing the same thing twice. If you want to do this with your manually paired samples, just remove the interaction factor. The conventional way to approach this would be to construct a blocking factor for subjects, an intervention factor, and a supplement factor. This would have the added benefit of allowing you to test for a supplement:intervention interaction, which I would presume is the coefficient of interest. I haven't checked, but I doubt you have the degrees of freedom to fit all those coefficients, so you would want to construct the design matrix like design <- model.matrix(~Intervention*supplement+blocking) in which case you will get an warning saying that one or more of the blocking factors is inestimable. Which isn't a problem, as these are nuisance factors, so you just want to account for them rather than actually getting a meaningful estimate. Best, Jim Best, Jim > > > Thanks, > Guido > > --------------------------------------------------------- > Guido Hooiveld, PhD > Nutrition, Metabolism& Genomics Group > Division of Human Nutrition > Wageningen University > Biotechnion, Bomenweg 2 > NL-6703 HD Wageningen > the Netherlands > tel: (+)31 317 485788 > fax: (+)31 317 483342 > email: guido.hooiveld at wur.nl<mailto:guido.hooiveld at="" wur.nl=""> > internet: http://nutrigene.4t.com > http://scholar.google.com/citations?user=qFHaMnoAAAAJ > http://www.researcherid.com/rid/F-4912-2010 > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician University of Washington Environmental and Occupational Health Sciences 4225 Roosevelt Way NE, # 100 Seattle WA 98105-6099
ADD REPLY

Login before adding your answer.

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