Limma model parameters design, combining a paired with a factorial design
1
1
Entering edit mode
john herbert ▴ 560
@john-herbert-4612
Last seen 10.2 years ago
Hello, I have a complex design matrix to produce (for me anyway) for single colour array data. I have 16 samples for 8 patients, which are paired (P1 to P4). Patients 1 and 3 are control patients and patients 2 and 4 are affected Before and after refer to before and after an operation. File1 P1 Control before File2 P1 Control after File3 P2 Affected before File4 P2 Affected after File5 P3 Control before File6 P3 Control after File7 P4 Affected before File8 P4 Affected after If to look at the Limma manual, section "8.3 Paired Samples" looks almost good for this design. However, does it need combining with a factorial design (section "8.7 Factorial Designs") as there is a before and after op? How do I combine a design for paired samples with a factorial design? >From the manual, below, the paired and the factorial examples looks scary to combine. ? FileName SibShip Treatment File1 1 C File2 1 T File3 2 C File4 2 T File5 3 C File6 3 T A moderated paired t-test can be computed by allowing for sib-pair e ects in the linear model: > SibShip <- factor(targets$SibShip) > Treat <- factor(targets$Treatment, levels=c("C","T")) > design <- model.matrix(~SibShip+Treat) > fit <- lmFit(eset, design) > fit <- eBayes(fit) > topTable(fit, coef="TreatT") frame: FileName Strain Treatment File1 WT U File2 WT S File3 Mu U File4 Mu S File5 Mu S > TS <- paste(targets$Strain, targets$Treatment, sep=".") > TS [1] "WT.U" "WT.S" "Mu.U" "Mu.S" "Mu.S" > TS <- factor(TS, levels=c("WT.U","WT.S","Mu.U","Mu.S")) > design <- model.matrix(~0+TS) > colnames(design) <- levels(TS) > fit <- lmFit(eset, design) > cont.matrix <- makeContrasts( WT.SvsU=WT.S-WT.U, Mu.SvsU=Mu.S-Mu.U, Diff=(Mu.S-Mu.U)-(WT.S-WT.U), levels=design) > fit2 <- contrasts.fit(fit, cont.matrix) > fit2 <- eBayes(fit2) We can use topTable() to look at lists of di erentially expressed genes for each of three contrasts, or else 48> results <- decideTests(fit2) > vennDiagram(results)
limma limma • 1.9k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 5 hours ago
United States
Hi John, On 10/13/2011 1:29 PM, john herbert wrote: > Hello, > I have a complex design matrix to produce (for me anyway) for single > colour array data. > > I have 16 samples for 8 patients, which are paired (P1 to P4). > > Patients 1 and 3 are control patients and patients 2 and 4 are affected > > Before and after refer to before and after an operation. > > File1 P1 Control before > File2 P1 Control after > File3 P2 Affected before > File4 P2 Affected after > File5 P3 Control before > File6 P3 Control after > File7 P4 Affected before > File8 P4 Affected after > > If to look at the Limma manual, section "8.3 Paired Samples" looks > almost good for this design. > > However, does it need combining with a factorial design (section "8.7 > Factorial Designs") as there is a before and after op? You don't have a factorial design. This is just a simple control vs affected with pairing. If the before and after were different people, this could be analyzed as a factorial design, but since they are the same person you cannot assume independence between the before and after samples. pairs <- factor(rep(1:4, each = 2)) type <- factor(rep(1:2, each = 2, times = 2)) design <- model.matrix(~type+pairs) fit <- lmFit(eset, design) fit2 <- eBayes(fit) topTable(fit2, coef = 2) Best, Jim > > How do I combine a design for paired samples with a factorial design? > > > > From the manual, below, the paired and the factorial examples looks > scary to combine. ? > > FileName SibShip Treatment > File1 1 C > File2 1 T > File3 2 C > File4 2 T > File5 3 C > File6 3 T > > A moderated paired t-test can be computed by allowing for sib-pair > e ects in the linear model: >> SibShip<- factor(targets$SibShip) >> Treat<- factor(targets$Treatment, levels=c("C","T")) >> design<- model.matrix(~SibShip+Treat) >> fit<- lmFit(eset, design) >> fit<- eBayes(fit) >> topTable(fit, coef="TreatT") > > frame: > > FileName Strain Treatment > File1 WT U > File2 WT S > File3 Mu U > File4 Mu S > File5 Mu S > >> TS<- paste(targets$Strain, targets$Treatment, sep=".") >> TS > [1] "WT.U" "WT.S" "Mu.U" "Mu.S" "Mu.S" > >> TS<- factor(TS, levels=c("WT.U","WT.S","Mu.U","Mu.S")) >> design<- model.matrix(~0+TS) >> colnames(design)<- levels(TS) >> fit<- lmFit(eset, design) >> cont.matrix<- makeContrasts( > WT.SvsU=WT.S-WT.U, > Mu.SvsU=Mu.S-Mu.U, > Diff=(Mu.S-Mu.U)-(WT.S-WT.U), levels=design) >> fit2<- contrasts.fit(fit, cont.matrix) >> fit2<- eBayes(fit2) > We can use topTable() to look at lists of di erentially expressed > genes for each of three > contrasts, or else > 48> results<- decideTests(fit2) >> vennDiagram(results) > _______________________________________________ > 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 Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
ADD COMMENT
0
Entering edit mode
Dear James, I am sorry for the delayed reply, I was excited to do the analyses (a good sign from a science point of view). Thank you very much for your help. Although not independent as you say, I would guess the operation is having a significant effect on gene expression, so I decided to do 2 separate analyses (comparing case vs. control for both before and after the operation). Kind regards, John. On Thu, Oct 13, 2011 at 6:57 PM, James W. MacDonald <jmacdon at="" med.umich.edu=""> wrote: > Hi John, > > On 10/13/2011 1:29 PM, john herbert wrote: >> >> Hello, >> I have a complex design matrix to produce (for me anyway) for single >> colour array data. >> >> I have 16 samples for 8 patients, which are paired (P1 to P4). >> >> Patients 1 and 3 are control patients and patients 2 and 4 are affected >> >> Before and after refer to before and after an operation. >> >> File1 P1 Control before >> File2 P1 Control after >> File3 P2 Affected before >> File4 P2 Affected after >> File5 P3 Control before >> File6 P3 Control after >> File7 P4 Affected before >> File8 P4 Affected after >> >> If to look at the Limma manual, section "8.3 Paired Samples" looks >> almost good for this design. >> >> However, does it need combining with a factorial design (section "8.7 >> Factorial Designs") as there is a before and after op? > > You don't have a factorial design. This is just a simple control vs affected > with pairing. > > If the before and after were different people, this could be analyzed as a > factorial design, but since they are the same person you cannot assume > independence between the before and after samples. > > pairs <- factor(rep(1:4, each = 2)) > type <- factor(rep(1:2, each = 2, times = 2)) > > design <- model.matrix(~type+pairs) > fit <- lmFit(eset, design) > fit2 <- eBayes(fit) > > topTable(fit2, coef = 2) > > Best, > > Jim > > > >> >> How do I combine a design for paired samples with a factorial design? >> >> >> > From the manual, below, the paired and the factorial examples looks >> scary to combine. ? >> >> FileName SibShip Treatment >> File1 1 C >> File2 1 T >> File3 2 C >> File4 2 T >> File5 3 C >> File6 3 T >> >> A moderated paired t-test can be computed by allowing for sib-pair >> e ects in the linear model: >>> >>> SibShip<- factor(targets$SibShip) >>> Treat<- factor(targets$Treatment, levels=c("C","T")) >>> design<- model.matrix(~SibShip+Treat) >>> fit<- lmFit(eset, design) >>> fit<- eBayes(fit) >>> topTable(fit, coef="TreatT") >> >> frame: >> >> FileName Strain Treatment >> File1 WT U >> File2 WT S >> File3 Mu U >> File4 Mu S >> File5 Mu S >> >>> TS<- paste(targets$Strain, targets$Treatment, sep=".") >>> TS >> >> [1] "WT.U" "WT.S" "Mu.U" "Mu.S" "Mu.S" >> >>> TS<- factor(TS, levels=c("WT.U","WT.S","Mu.U","Mu.S")) >>> design<- model.matrix(~0+TS) >>> colnames(design)<- levels(TS) >>> fit<- lmFit(eset, design) >>> cont.matrix<- makeContrasts( >> >> ? WT.SvsU=WT.S-WT.U, >> ? Mu.SvsU=Mu.S-Mu.U, >> ? Diff=(Mu.S-Mu.U)-(WT.S-WT.U), levels=design) >>> >>> fit2<- contrasts.fit(fit, cont.matrix) >>> fit2<- eBayes(fit2) >> >> We can use topTable() to look at lists of di erentially expressed >> genes for each of three >> contrasts, or else >> 48> ?results<- decideTests(fit2) >>> >>> vennDiagram(results) >> >> _______________________________________________ >> 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 > Douglas Lab > University of Michigan > Department of Human Genetics > 5912 Buhl > 1241 E. Catherine St. > Ann Arbor MI 48109-5618 > 734-615-7826 > > ********************************************************** > Electronic Mail is not secure, may not be read every day, and should not be > used for urgent or sensitive issues >
ADD REPLY

Login before adding your answer.

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