multi-level design - a simplified question - corrected table
1
0
Entering edit mode
@gordon-smyth
Last seen 13 minutes ago
WEHI, Melbourne, Australia
> Date: Wed, 30 Jul 2014 22:01:34 +0000 > From: "Rao,Xiayu" <xrao at="" mdanderson.org=""> > To: "bioconductor at r-project.org" <bioconductor at="" r-project.org=""> > Subject: [BioC] multi-level design - a simplified question - corrected > table > > Hello all, > > I do need some help on analyzing such unorganized data. Please help me out. Thank you so much! > I basically followed the analysis of multi-level experiments in limma user guide. But I do not feel right about the code below. Please give me some suggestions. > > # I want to compare Normal vs. Tumor negative, and Normal vs Tumor positive. There are partial pairing (subject) and batch effect (chip). > Treat <- factor(paste(targets$chip,targets$type,sep=".")) > design <- model.matrix(~0+Treat) No, this isn't correct. If you need to correct for a batch effect (and have you checked that you really need this?), then it should be design <- model.matrix(+0+type+chip) where type and chip are both factors. Then, when you take contrasts later on, you simply compare the type levels that are relevant. Or better still, type <- relevel(type, ref="N") design <- model.matrix(~type+chip) corfit <- duplicateCorrelation(y,design,block=targets$subject) fit <- lmFit(y,design,block=targets$subject,correlation=corfit$consensus) fit <- eBayes(fit) topTable(fit, coef="typeTneg") topTable(fit, coef="typeTpos") Best wishes Gordon > colnames(design) <- levels(Treat) > > corfit <- duplicateCorrelation(y,design,block=targets$subject) > corfit$consensus > fit <- lmFit(y,design,block=targets$subject,correlation=corfit$consensus) > cm <- makeContrasts(TposvsN=(a1.Tpos+a2.Tpos+a3.Tpos)/3-(a1.N+a2.N)/2, TnegvsN=(a1.Tneg+a3.Tneg)/2-(a1.N+a2.N)/2, levels=design) ???? > fit2 <- contrasts.fit(fit, cm) > fit2 <- eBayes(fit2) > topTable(fit2, coef=1, sort.by="p") > > sample type subject chip > s1 Tneg 1 a1 > s2 N 1 a1 > s3 Tpos 2 a1 > s4 N 2 a1 > s5 Tneg 3 a1 > s6 N 3 a1 > s7 Tpos 4 a1 > s8 N 4 a1 > s9 Tpos 5 a2 > s10 N 5 a2 > s11 N 6 a2 > s12 Tpos 7 a2 > s13 N 7 a2 > s14 Tpos 8 a2 > s15 N 8 a2 > s16 Tneg 9 a3 > s17 Tneg 10 a3 > s18 Tneg 11 a3 > s19 Tpos 6 a3 > s20 Tpos 12 a3 > s21 Tneg 13 a3 > s22 Tpos 14 a3 > > > Thanks, > Xiayu ______________________________________________________________________ The information in this email is confidential and intend...{{dropped:4}}
• 1.1k views
ADD COMMENT
0
Entering edit mode
Rao,Xiayu ▴ 550
@raoxiayu-6003
Last seen 8.9 years ago
United States
Hi, Godon Thank you very much for providing two solutions! Very helpful! Thanks, Xiayu -----Original Message----- From: Gordon K Smyth [mailto:smyth@wehi.EDU.AU] Sent: Sunday, August 03, 2014 7:38 PM To: Rao,Xiayu Cc: Bioconductor mailing list Subject: multi-level design - a simplified question - corrected table > Date: Wed, 30 Jul 2014 22:01:34 +0000 > From: "Rao,Xiayu" <xrao at="" mdanderson.org=""> > To: "bioconductor at r-project.org" <bioconductor at="" r-project.org=""> > Subject: [BioC] multi-level design - a simplified question - corrected > table > > Hello all, > > I do need some help on analyzing such unorganized data. Please help me out. Thank you so much! > I basically followed the analysis of multi-level experiments in limma user guide. But I do not feel right about the code below. Please give me some suggestions. > > # I want to compare Normal vs. Tumor negative, and Normal vs Tumor positive. There are partial pairing (subject) and batch effect (chip). > Treat <- factor(paste(targets$chip,targets$type,sep=".")) > design <- model.matrix(~0+Treat) No, this isn't correct. If you need to correct for a batch effect (and have you checked that you really need this?), then it should be design <- model.matrix(+0+type+chip) where type and chip are both factors. Then, when you take contrasts later on, you simply compare the type levels that are relevant. Or better still, type <- relevel(type, ref="N") design <- model.matrix(~type+chip) corfit <- duplicateCorrelation(y,design,block=targets$subject) fit <- lmFit(y,design,block=targets$subject,correlation=corfit$consensus) fit <- eBayes(fit) topTable(fit, coef="typeTneg") topTable(fit, coef="typeTpos") Best wishes Gordon > colnames(design) <- levels(Treat) > > corfit <- duplicateCorrelation(y,design,block=targets$subject) > corfit$consensus > fit <- lmFit(y,design,block=targets$subject,correlation=corfit$consensus) > cm <- makeContrasts(TposvsN=(a1.Tpos+a2.Tpos+a3.Tpos)/3-(a1.N+a2.N)/2, TnegvsN=(a1.Tneg+a3.Tneg)/2-(a1.N+a2.N)/2, levels=design) ???? > fit2 <- contrasts.fit(fit, cm) > fit2 <- eBayes(fit2) > topTable(fit2, coef=1, sort.by="p") > > sample type subject chip > s1 Tneg 1 a1 > s2 N 1 a1 > s3 Tpos 2 a1 > s4 N 2 a1 > s5 Tneg 3 a1 > s6 N 3 a1 > s7 Tpos 4 a1 > s8 N 4 a1 > s9 Tpos 5 a2 > s10 N 5 a2 > s11 N 6 a2 > s12 Tpos 7 a2 > s13 N 7 a2 > s14 Tpos 8 a2 > s15 N 8 a2 > s16 Tneg 9 a3 > s17 Tneg 10 a3 > s18 Tneg 11 a3 > s19 Tpos 6 a3 > s20 Tpos 12 a3 > s21 Tneg 13 a3 > s22 Tpos 14 a3 > > > Thanks, > Xiayu ______________________________________________________________________ The information in this email is confidential and intend...{{dropped:6}}
ADD COMMENT

Login before adding your answer.

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