limma design matrix missing a Date column
1
0
Entering edit mode
@sabet-julia-a-6404
Last seen 10.2 years ago
Hello, I am trying to make a design matrix for limma and include date to account for batch effects, but when I construct the matrix, one of the dates is excluded for some reason (1/7/2014). I am interested in comparing the effects of diet within males and females separately. Any ideas why this date would be excluded? This is the targets frame that I read into R: Name FileName Sex PaternalDiet Date 498 498 Julia_01072014_(MoGene-2_0-st).CEL female c 1/7/2014 594 594 Julia_01082014_(MoGene-2_0-st).CEL female c 1/8/2014 721 721 Julia_01072014_(MoGene-2_0-st).CEL female c 1/7/2014 731 731 Julia_01092014_(MoGene-2_0-st).CEL female c 1/9/2014 766 766 Julia_01092014_(MoGene-2_0-st).CEL female c 1/9/2014 439 439 Julia_01092014_(MoGene-2_0-st).CEL female d 1/9/2014 448 448 julia_01072014_(MoGene-2_0-st).CEL female d 1/7/2014 475 475 Julia_01082014_(MoGene-2_0-st).CEL female d 1/8/2014 575 575 Julia_01072014_(MoGene-2_0-st).CEL female d 1/7/2014 704 704 julia_01072014_(MoGene-2_0-st).CEL female d 1/7/2014 749 749 Julia_01082014_(MoGene-2_0-st).CEL female d 1/8/2014 500 500 Julia_01092014_(MoGene-2_0-st).CEL female s 1/9/2014 524 524 Julia_02042014_(MoGene-2_0-st).CEL female s 2/4/2014 580 580 Julia_01072014_(MoGene-2_0-st).CEL female s 1/7/2014 710 710 Julia_01092014_(MoGene-2_0-st).CEL female s 1/9/2014 778 778 Julia_01082014_(MoGene-2_0-st).CEL female s 1/8/2014 797 797 Julia_01092014_(MoGene-2_0-st).CEL female s 1/9/2014 472 472 Julia_01082014_(MoGene-2_0-st).CEL male c 1/8/2014 570 570 Julia_01082014_(MoGene-2_0-st).CEL male c 1/8/2014 573 573 Julia_01092014_(MoGene-2_0-st).CEL male c 1/9/2014 735 735 Julia_01072014_(MoGene-2_0-st).CEL male c 1/7/2014 737 737 Julia_01092014_(MoGene-2_0-st).CEL male c 1/9/2014 771 771 Julia_01082014_(MoGene-2_0-st).CEL male c 1/8/2014 442 442 Julia_01092014_(MoGene-2_0-st).CEL male d 1/9/2014 452 452 Julia_01082014_(MoGene-2_0-st).CEL male d 1/8/2014 579 579 Julia_01092014_(MoGene-2_0-st).CEL male d 1/9/2014 636 636 Julia_01082014_(MoGene-2_0-st).CEL male d 1/8/2014 751 751Julia_01072014_(MoGene-2_0-st).CEL male d 1/7/2014 754 754 Julia_01092014_(MoGene-2_0-st).CEL male d 1/9/2014 503 503 Julia_01092014_(MoGene-2_0-st).CEL male s 1/9/2014 585 585 Julia_01082014_(MoGene-2_0-st).CEL male s 1/8/2014 660 660 Julia_01072014_(MoGene-2_0-st).CEL male s 1/7/2014 714 714 Julia_01072014_(MoGene-2_0-st).CEL male s 1/7/2014 762 762 Julia_01082014_(MoGene-2_0-st).CEL male s 1/8/2014 779 779 Julia_01082014_(MoGene-2_0-st).CEL male s 1/8/2014 470 470 Julia_02042014_(MoGene-2_0-st).CEL female c 2/4/2014 This is the code that I used, and the resulting design matrix: > targets <- readTargets("targets.txt", row.names="Name") > DS <- paste(targets$PaternalDiet, targets$Sex, sep=".") > DS<-factor(DS, levels=c("c.female","d.female","s.female","c.male","d.male","s.male")) > design <- model.matrix(~0+DS+Date, targets) > design DSc.female DSd.female DSs.female DSc.male DSd.male DSs.male Date1/8/2014 498 1 0 0 0 0 0 0 594 1 0 0 0 0 0 1 721 1 0 0 0 0 0 0 731 1 0 0 0 0 0 0 766 1 0 0 0 0 0 0 439 0 1 0 0 0 0 0 448 0 1 0 0 0 0 0 475 0 1 0 0 0 0 1 575 0 1 0 0 0 0 0 704 0 1 0 0 0 0 0 749 0 1 0 0 0 0 1 500 0 0 1 0 0 0 0 524 0 0 1 0 0 0 0 580 0 0 1 0 0 0 0 710 0 0 1 0 0 0 0 778 0 0 1 0 0 0 1 797 0 0 1 0 0 0 0 472 0 0 0 1 0 0 1 570 0 0 0 1 0 0 1 573 0 0 0 1 0 0 0 735 0 0 0 1 0 0 0 737 0 0 0 1 0 0 0 771 0 0 0 1 0 0 1 442 0 0 0 0 1 0 0 452 0 0 0 0 1 0 1 579 0 0 0 0 1 0 0 636 0 0 0 0 1 0 1 751 0 0 0 0 1 0 0 754 0 0 0 0 1 0 0 503 0 0 0 0 0 1 0 585 0 0 0 0 0 1 1 660 0 0 0 0 0 1 0 714 0 0 0 0 0 1 0 762 0 0 0 0 0 1 1 779 0 0 0 0 0 1 1 470 1 0 0 0 0 0 0 Date1/9/2014 Date2/4/2014 498 0 0 594 0 0 721 0 0 731 1 0 766 1 0 439 1 0 448 0 0 475 0 0 575 0 0 704 0 0 749 0 0 500 1 0 524 0 1 580 0 0 710 1 0 778 0 0 797 1 0 472 0 0 570 0 0 573 1 0 735 0 0 737 1 0 771 0 0 442 1 0 452 0 0 579 1 0 636 0 0 751 0 0 754 1 0 503 1 0 585 0 0 660 0 0 714 0 0 762 0 0 779 0 0 470 0 1 attr(,"assign") [1] 1 1 1 1 1 1 2 2 2 attr(,"contrasts") attr(,"contrasts")$DS [1] "contr.treatment" attr(,"contrasts")$Date [1] "contr.treatment" Thanks for your help! Julia [[alternative HTML version deleted]]
limma DSS limma DSS • 1.5k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States
Hi Julia, That date isn't excluded; it's absorbed into the other non-date main effects. In other words, you can interpret DSc.female as being the mean expression for that group, on 1/7/2014. The other date coefficients are thus interpreted as the difference in expression levels between a given date and 1/7/2014 (e.g., the Date1/8/2014 coefficient estimates the mean difference between 1/8/2014 and 1/7/2014). But the upshot is that you have corrected for any date-specific batch effect, and you can make the comparisons you are interested in. You could also look at the F-test for the three date coefficients to see if you even need to adjust for date. Best, Jim On 2/20/2014 12:05 PM, Sabet, Julia A wrote: > Hello, > I am trying to make a design matrix for limma and include date to account for batch effects, but when I construct the matrix, one of the dates is excluded for some reason (1/7/2014). I am interested in comparing the effects of diet within males and females separately. Any ideas why this date would be excluded? This is the targets frame that I read into R: > > Name FileName Sex PaternalDiet Date > 498 498 Julia_01072014_(MoGene-2_0-st).CEL female c 1/7/2014 > 594 594 Julia_01082014_(MoGene-2_0-st).CEL female c 1/8/2014 > 721 721 Julia_01072014_(MoGene-2_0-st).CEL female c 1/7/2014 > 731 731 Julia_01092014_(MoGene-2_0-st).CEL female c 1/9/2014 > 766 766 Julia_01092014_(MoGene-2_0-st).CEL female c 1/9/2014 > 439 439 Julia_01092014_(MoGene-2_0-st).CEL female d 1/9/2014 > 448 448 julia_01072014_(MoGene-2_0-st).CEL female d 1/7/2014 > 475 475 Julia_01082014_(MoGene-2_0-st).CEL female d 1/8/2014 > 575 575 Julia_01072014_(MoGene-2_0-st).CEL female d 1/7/2014 > 704 704 julia_01072014_(MoGene-2_0-st).CEL female d 1/7/2014 > 749 749 Julia_01082014_(MoGene-2_0-st).CEL female d 1/8/2014 > 500 500 Julia_01092014_(MoGene-2_0-st).CEL female s 1/9/2014 > 524 524 Julia_02042014_(MoGene-2_0-st).CEL female s 2/4/2014 > 580 580 Julia_01072014_(MoGene-2_0-st).CEL female s 1/7/2014 > 710 710 Julia_01092014_(MoGene-2_0-st).CEL female s 1/9/2014 > 778 778 Julia_01082014_(MoGene-2_0-st).CEL female s 1/8/2014 > 797 797 Julia_01092014_(MoGene-2_0-st).CEL female s 1/9/2014 > 472 472 Julia_01082014_(MoGene-2_0-st).CEL male c 1/8/2014 > 570 570 Julia_01082014_(MoGene-2_0-st).CEL male c 1/8/2014 > 573 573 Julia_01092014_(MoGene-2_0-st).CEL male c 1/9/2014 > 735 735 Julia_01072014_(MoGene-2_0-st).CEL male c 1/7/2014 > 737 737 Julia_01092014_(MoGene-2_0-st).CEL male c 1/9/2014 > 771 771 Julia_01082014_(MoGene-2_0-st).CEL male c 1/8/2014 > 442 442 Julia_01092014_(MoGene-2_0-st).CEL male d 1/9/2014 > 452 452 Julia_01082014_(MoGene-2_0-st).CEL male d 1/8/2014 > 579 579 Julia_01092014_(MoGene-2_0-st).CEL male d 1/9/2014 > 636 636 Julia_01082014_(MoGene-2_0-st).CEL male d 1/8/2014 > 751 751Julia_01072014_(MoGene-2_0-st).CEL male d 1/7/2014 > 754 754 Julia_01092014_(MoGene-2_0-st).CEL male d 1/9/2014 > 503 503 Julia_01092014_(MoGene-2_0-st).CEL male s 1/9/2014 > 585 585 Julia_01082014_(MoGene-2_0-st).CEL male s 1/8/2014 > 660 660 Julia_01072014_(MoGene-2_0-st).CEL male s 1/7/2014 > 714 714 Julia_01072014_(MoGene-2_0-st).CEL male s 1/7/2014 > 762 762 Julia_01082014_(MoGene-2_0-st).CEL male s 1/8/2014 > 779 779 Julia_01082014_(MoGene-2_0-st).CEL male s 1/8/2014 > 470 470 Julia_02042014_(MoGene-2_0-st).CEL female c 2/4/2014 > > This is the code that I used, and the resulting design matrix: > >> targets <- readTargets("targets.txt", row.names="Name") >> DS <- paste(targets$PaternalDiet, targets$Sex, sep=".") >> DS<-factor(DS, levels=c("c.female","d.female","s.female","c.male","d.male","s.male")) >> design <- model.matrix(~0+DS+Date, targets) >> design > DSc.female DSd.female DSs.female DSc.male DSd.male DSs.male Date1/8/2014 > 498 1 0 0 0 0 0 0 > 594 1 0 0 0 0 0 1 > 721 1 0 0 0 0 0 0 > 731 1 0 0 0 0 0 0 > 766 1 0 0 0 0 0 0 > 439 0 1 0 0 0 0 0 > 448 0 1 0 0 0 0 0 > 475 0 1 0 0 0 0 1 > 575 0 1 0 0 0 0 0 > 704 0 1 0 0 0 0 0 > 749 0 1 0 0 0 0 1 > 500 0 0 1 0 0 0 0 > 524 0 0 1 0 0 0 0 > 580 0 0 1 0 0 0 0 > 710 0 0 1 0 0 0 0 > 778 0 0 1 0 0 0 1 > 797 0 0 1 0 0 0 0 > 472 0 0 0 1 0 0 1 > 570 0 0 0 1 0 0 1 > 573 0 0 0 1 0 0 0 > 735 0 0 0 1 0 0 0 > 737 0 0 0 1 0 0 0 > 771 0 0 0 1 0 0 1 > 442 0 0 0 0 1 0 0 > 452 0 0 0 0 1 0 1 > 579 0 0 0 0 1 0 0 > 636 0 0 0 0 1 0 1 > 751 0 0 0 0 1 0 0 > 754 0 0 0 0 1 0 0 > 503 0 0 0 0 0 1 0 > 585 0 0 0 0 0 1 1 > 660 0 0 0 0 0 1 0 > 714 0 0 0 0 0 1 0 > 762 0 0 0 0 0 1 1 > 779 0 0 0 0 0 1 1 > 470 1 0 0 0 0 0 0 > Date1/9/2014 Date2/4/2014 > 498 0 0 > 594 0 0 > 721 0 0 > 731 1 0 > 766 1 0 > 439 1 0 > 448 0 0 > 475 0 0 > 575 0 0 > 704 0 0 > 749 0 0 > 500 1 0 > 524 0 1 > 580 0 0 > 710 1 0 > 778 0 0 > 797 1 0 > 472 0 0 > 570 0 0 > 573 1 0 > 735 0 0 > 737 1 0 > 771 0 0 > 442 1 0 > 452 0 0 > 579 1 0 > 636 0 0 > 751 0 0 > 754 1 0 > 503 1 0 > 585 0 0 > 660 0 0 > 714 0 0 > 762 0 0 > 779 0 0 > 470 0 1 > attr(,"assign") > [1] 1 1 1 1 1 1 2 2 2 > attr(,"contrasts") > attr(,"contrasts")$DS > [1] "contr.treatment" > > attr(,"contrasts")$Date > [1] "contr.treatment" > > Thanks for your help! > Julia > > [[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 COMMENT

Login before adding your answer.

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