Any problem with the design matrix or the contrasts? Thanks
2
0
Entering edit mode
Rao,Xiayu ▴ 550
@raoxiayu-6003
Last seen 8.8 years ago
United States
Hello, I learned from posts in the forum and analyzed my data using the suggested design and contrasts. It turns out there are no sig genes or few in the end. Could you please help check if the design does not fit the data or the contrasts made are incorrect?? #the research questions are 1) to compare between pos and neg for AR, and 2) Male.pos vs. Female.pos. Treat <- factor(paste(targets$gender,targets$AR,sep=".")) chip <- factor(targets$chip) design <- model.matrix(~0+Treat+chip) colnames(design)[1:4] <- levels(Treat) fit <- lmFit(y,design) cm <- makeContrasts(posVSneg=(F.pos+M.pos-F.neg-M.neg)/2, MposVSFpos=M.pos-F.pos, levels=design) fit2 <- contrasts.fit(fit,cm) fit2 <- eBayes(fit2) topTable(fit2, coef="posVSneg", sort.by="p") #0 sig genes topTable(fit2, n=20,coef="MposVSFpos", sort.by="p") #4 sig genes targets.txt sample gender AR chip s1 F pos 1 s2 F neg 1 s3 M neg 2 s4 M pos 2 s5 F neg 2 s6 M pos 2 s7 M pos 2 s8 M pos 3 s9 M pos 3 s10 M pos 3 s11 M pos 3 s12 F pos 4 s13 F pos 4 s14 M pos 4 s15 M pos 4 s16 F pos 5 s17 M pos 5 s18 M pos 5 s19 M neg 6 s20 M neg 6 s21 F neg 6 s22 F pos 6 s23 F pos 6 s24 F neg 6 s25 F pos 6 s26 F pos 6 s27 F pos 6 s28 M neg 6 Thanks, Xiayu [[alternative HTML version deleted]]
• 1.5k views
ADD COMMENT
0
Entering edit mode
@ryan-c-thompson-5618
Last seen 7 months ago
Scripps Research, La Jolla, CA
Hi, You're going to need to address your two scientific questions using separate fits. This is because your first question (pos vs neg) is testing a main effect, and you are effectively fitting an interaction model (one coefficient for each combination of AR & gender). So your interaction model is correct for testing the second question, which is testing one factor within only a single level of the other. But for testing the main effect, you'll need to fit an additive model using the formula suggested by Federico. Furthermore, the test for a main effect may not be valid in the presence of an interaction effect, so you should test for that too using the interaction model, and then look closely at the data before trusting probe sets that are significant for both the main effect and interaction effect. The interaction contrast using your design would be ((F.pos-M.pos)-(F.neg-M.neg)). -Ryan On 08/01/2014 08:07 AM, Rao,Xiayu wrote: > Hello, > > I learned from posts in the forum and analyzed my data using the suggested design and contrasts. It turns out there are no sig genes or few in the end. Could you please help check if the design does not fit the data or the contrasts made are incorrect?? > > #the research questions are 1) to compare between pos and neg for AR, and 2) Male.pos vs. Female.pos. > > Treat <- factor(paste(targets$gender,targets$AR,sep=".")) > chip <- factor(targets$chip) > design <- model.matrix(~0+Treat+chip) > colnames(design)[1:4] <- levels(Treat) > fit <- lmFit(y,design) > > cm <- makeContrasts(posVSneg=(F.pos+M.pos-F.neg-M.neg)/2, MposVSFpos=M.pos-F.pos, levels=design) > fit2 <- contrasts.fit(fit,cm) > fit2 <- eBayes(fit2) > topTable(fit2, coef="posVSneg", sort.by="p") #0 sig genes > topTable(fit2, n=20,coef="MposVSFpos", sort.by="p") #4 sig genes > > targets.txt > sample gender AR chip > s1 F pos 1 > s2 F neg 1 > s3 M neg 2 > s4 M pos 2 > s5 F neg 2 > s6 M pos 2 > s7 M pos 2 > s8 M pos 3 > s9 M pos 3 > s10 M pos 3 > s11 M pos 3 > s12 F pos 4 > s13 F pos 4 > s14 M pos 4 > s15 M pos 4 > s16 F pos 5 > s17 M pos 5 > s18 M pos 5 > s19 M neg 6 > s20 M neg 6 > s21 F neg 6 > s22 F pos 6 > s23 F pos 6 > s24 F neg 6 > s25 F pos 6 > s26 F pos 6 > s27 F pos 6 > s28 M neg 6 > > > Thanks, > Xiayu > > [[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
ADD COMMENT
0
Entering edit mode
Hi, Ryan Thanks a lot for your comments! It is good to know that testing for a main effect using only the additive model may not be valid in the presence of an interaction effect, which I agree as I recall that from my statistics course. I did what you suggested and tested for the interaction effect in the interaction model as below. There are no sig diff genes in the end (no interaction effect). So I think now it is safe to apply the additive model. But what if there is an interaction effect? In that case, to test for ARpos vs. ARneg, I think the model should be y=b0 + b1*gender + b2*AR + b3*chip + b3*gender*AR , so the code would be: design <- model.matrix(~0+AR+gender+chip+AR*gender), right ?? In addition, I guess there is no difference in testing for the 2nd question Mpos vs. Fpos using the interaction model, right ?? Treat <- factor(paste(targets$gender,targets$AR,sep=".")) design <- model.matrix(~0+Treat+chip) cm <- makeContrasts((F.pos-M.pos)-(F.neg-M.neg),levels=design) Thanks, Xiayu -----Original Message----- From: Ryan C. Thompson [mailto:rct@thompsonclan.org] Sent: Friday, August 08, 2014 4:14 PM To: Rao,Xiayu; 'bioconductor at stat.math.ethz.ch' Subject: Re: [BioC] Any problem with the design matrix or the contrasts? Thanks Hi, You're going to need to address your two scientific questions using separate fits. This is because your first question (pos vs neg) is testing a main effect, and you are effectively fitting an interaction model (one coefficient for each combination of AR & gender). So your interaction model is correct for testing the second question, which is testing one factor within only a single level of the other. But for testing the main effect, you'll need to fit an additive model using the formula suggested by Federico. Furthermore, the test for a main effect may not be valid in the presence of an interaction effect, so you should test for that too using the interaction model, and then look closely at the data before trusting probe sets that are significant for both the main effect and interaction effect. The interaction contrast using your design would be ((F.pos-M.pos)-(F.neg-M.neg)). -Ryan On 08/01/2014 08:07 AM, Rao,Xiayu wrote: > Hello, > > I learned from posts in the forum and analyzed my data using the suggested design and contrasts. It turns out there are no sig genes or few in the end. Could you please help check if the design does not fit the data or the contrasts made are incorrect?? > > #the research questions are 1) to compare between pos and neg for AR, and 2) Male.pos vs. Female.pos. > > Treat <- factor(paste(targets$gender,targets$AR,sep=".")) > chip <- factor(targets$chip) > design <- model.matrix(~0+Treat+chip) > colnames(design)[1:4] <- levels(Treat) fit <- lmFit(y,design) > > cm <- makeContrasts(posVSneg=(F.pos+M.pos-F.neg-M.neg)/2, > MposVSFpos=M.pos-F.pos, levels=design) > fit2 <- contrasts.fit(fit,cm) > fit2 <- eBayes(fit2) > topTable(fit2, coef="posVSneg", sort.by="p") #0 sig genes > topTable(fit2, n=20,coef="MposVSFpos", sort.by="p") #4 sig genes > > targets.txt > sample gender AR chip > s1 F pos 1 > s2 F neg 1 > s3 M neg 2 > s4 M pos 2 > s5 F neg 2 > s6 M pos 2 > s7 M pos 2 > s8 M pos 3 > s9 M pos 3 > s10 M pos 3 > s11 M pos 3 > s12 F pos 4 > s13 F pos 4 > s14 M pos 4 > s15 M pos 4 > s16 F pos 5 > s17 M pos 5 > s18 M pos 5 > s19 M neg 6 > s20 M neg 6 > s21 F neg 6 > s22 F pos 6 > s23 F pos 6 > s24 F neg 6 > s25 F pos 6 > s26 F pos 6 > s27 F pos 6 > s28 M neg 6 > > > Thanks, > Xiayu > > [[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
ADD REPLY
0
Entering edit mode
If there is an interaction term in your model, then there is no way to test for an unconditional main effect. You can only test some weighted average of the gender-specific pos vs neg effects. The contrast you originally spcified was "(F.pos+M.pos-F.neg-M.neg)/2", which can be rewritten as "0.5 * (F.pos - F.neg) + 0.5 * (M.pos - M.neg)". This represents pos vs neg for a hypothetical 50% male, 50% female population, which isn't the same thing as a main effect, although it might happen to be similar. Note that "the interaction term has no significant genes for the interaction term" is not the same as "there is no interaction". It could be that there is an interaction in some genes, but your experiment is not powered to detect it. But I'm afraid I'm not very familiar with the details on how else you could test whether there is an interaction to worry about, other than relying on prior knowledge. Most studies don't go that far in justifying their choice of statistical model. -Ryan On Fri 08 Aug 2014 03:06:50 PM PDT, Rao,Xiayu wrote: > Hi, Ryan > > Thanks a lot for your comments! It is good to know that testing for a main effect using only the additive model may not be valid in the presence of an interaction effect, which I agree as I recall that from my statistics course. I did what you suggested and tested for the interaction effect in the interaction model as below. There are no sig diff genes in the end (no interaction effect). So I think now it is safe to apply the additive model. But what if there is an interaction effect? In that case, to test for ARpos vs. ARneg, I think the model should be y=b0 + b1*gender + b2*AR + b3*chip + b3*gender*AR , so the code would be: design <- model.matrix(~0+AR+gender+chip+AR*gender), right ?? In addition, I guess there is no difference in testing for the 2nd question Mpos vs. Fpos using the interaction model, right ?? > > Treat <- factor(paste(targets$gender,targets$AR,sep=".")) > design <- model.matrix(~0+Treat+chip) > cm <- makeContrasts((F.pos-M.pos)-(F.neg-M.neg),levels=design) > > Thanks, > Xiayu > > > > > -----Original Message----- > From: Ryan C. Thompson [mailto:rct at thompsonclan.org] > Sent: Friday, August 08, 2014 4:14 PM > To: Rao,Xiayu; 'bioconductor at stat.math.ethz.ch' > Subject: Re: [BioC] Any problem with the design matrix or the contrasts? Thanks > > Hi, > > You're going to need to address your two scientific questions using separate fits. This is because your first question (pos vs neg) is testing a main effect, and you are effectively fitting an interaction model (one coefficient for each combination of AR & gender). So your interaction model is correct for testing the second question, which is testing one factor within only a single level of the other. But for testing the main effect, you'll need to fit an additive model using the formula suggested by Federico. Furthermore, the test for a main effect may not be valid in the presence of an interaction effect, so you should test for that too using the interaction model, and then look closely at the data before trusting probe sets that are significant for both the main effect and interaction effect. The interaction contrast using your design would be ((F.pos-M.pos)-(F.neg-M.neg)). > > -Ryan > > On 08/01/2014 08:07 AM, Rao,Xiayu wrote: >> Hello, >> >> I learned from posts in the forum and analyzed my data using the suggested design and contrasts. It turns out there are no sig genes or few in the end. Could you please help check if the design does not fit the data or the contrasts made are incorrect?? >> >> #the research questions are 1) to compare between pos and neg for AR, and 2) Male.pos vs. Female.pos. >> >> Treat <- factor(paste(targets$gender,targets$AR,sep=".")) >> chip <- factor(targets$chip) >> design <- model.matrix(~0+Treat+chip) >> colnames(design)[1:4] <- levels(Treat) fit <- lmFit(y,design) >> >> cm <- makeContrasts(posVSneg=(F.pos+M.pos-F.neg-M.neg)/2, >> MposVSFpos=M.pos-F.pos, levels=design) >> fit2 <- contrasts.fit(fit,cm) >> fit2 <- eBayes(fit2) >> topTable(fit2, coef="posVSneg", sort.by="p") #0 sig genes >> topTable(fit2, n=20,coef="MposVSFpos", sort.by="p") #4 sig genes >> >> targets.txt >> sample gender AR chip >> s1 F pos 1 >> s2 F neg 1 >> s3 M neg 2 >> s4 M pos 2 >> s5 F neg 2 >> s6 M pos 2 >> s7 M pos 2 >> s8 M pos 3 >> s9 M pos 3 >> s10 M pos 3 >> s11 M pos 3 >> s12 F pos 4 >> s13 F pos 4 >> s14 M pos 4 >> s15 M pos 4 >> s16 F pos 5 >> s17 M pos 5 >> s18 M pos 5 >> s19 M neg 6 >> s20 M neg 6 >> s21 F neg 6 >> s22 F pos 6 >> s23 F pos 6 >> s24 F neg 6 >> s25 F pos 6 >> s26 F pos 6 >> s27 F pos 6 >> s28 M neg 6 >> >> >> Thanks, >> Xiayu >> >> [[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 >
ADD REPLY
0
Entering edit mode
@federico-lasa-6147
Last seen 9.6 years ago
Both a question and a quick suggestion.. For the first case, should/does design <- model.matrix(~0+AR +gender +chip, data=targets) cm<-makeContrasts(ARpos-ARneg, levels=design) produce the same results you have? On Fri, Aug 1, 2014 at 10:07 AM, Rao,Xiayu <xrao at="" mdanderson.org=""> wrote: > Hello, > > I learned from posts in the forum and analyzed my data using the suggested design and contrasts. It turns out there are no sig genes or few in the end. Could you please help check if the design does not fit the data or the contrasts made are incorrect?? > > #the research questions are 1) to compare between pos and neg for AR, and 2) Male.pos vs. Female.pos. > > Treat <- factor(paste(targets$gender,targets$AR,sep=".")) > chip <- factor(targets$chip) > design <- model.matrix(~0+Treat+chip) > colnames(design)[1:4] <- levels(Treat) > fit <- lmFit(y,design) > > cm <- makeContrasts(posVSneg=(F.pos+M.pos-F.neg-M.neg)/2, MposVSFpos=M.pos-F.pos, levels=design) > fit2 <- contrasts.fit(fit,cm) > fit2 <- eBayes(fit2) > topTable(fit2, coef="posVSneg", sort.by="p") #0 sig genes > topTable(fit2, n=20,coef="MposVSFpos", sort.by="p") #4 sig genes > > targets.txt > sample gender AR chip > s1 F pos 1 > s2 F neg 1 > s3 M neg 2 > s4 M pos 2 > s5 F neg 2 > s6 M pos 2 > s7 M pos 2 > s8 M pos 3 > s9 M pos 3 > s10 M pos 3 > s11 M pos 3 > s12 F pos 4 > s13 F pos 4 > s14 M pos 4 > s15 M pos 4 > s16 F pos 5 > s17 M pos 5 > s18 M pos 5 > s19 M neg 6 > s20 M neg 6 > s21 F neg 6 > s22 F pos 6 > s23 F pos 6 > s24 F neg 6 > s25 F pos 6 > s26 F pos 6 > s27 F pos 6 > s28 M neg 6 > > > Thanks, > Xiayu > > [[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
ADD COMMENT
0
Entering edit mode
Thank you for your kind suggestion, Federico! I tried your suggested design, and found the result is different. There are 10 sig DEGs in the end. > design <- model.matrix(~0+AR+gender+chip,data=targets) > design ARneg ARpos genderM chip 1 0 1 0 1 2 1 0 0 1 3 1 0 1 2 4 0 1 1 2 5 1 0 0 2 6 0 1 1 2 7 0 1 1 2 8 0 1 1 3 9 0 1 1 3 10 0 1 1 3 11 0 1 1 3 12 0 1 0 4 13 0 1 0 4 14 0 1 1 4 15 0 1 1 4 16 0 1 0 5 17 0 1 1 5 18 0 1 1 5 I also tried this design, which I originally thought would be the same as yours, but is different. There are 3 sig DEGs in the end. Could you please explain the cause of the difference ?? > gender <- factor(targets$gender) > AR <- factor(targets$AR) > chip <- factor(targets$chip) > design <- model.matrix(~0+AR+gender+chip) > design ARneg ARpos genderM chip2 chip3 chip4 chip5 chip6 1 0 1 0 0 0 0 0 0 2 1 0 0 0 0 0 0 0 3 1 0 1 1 0 0 0 0 4 0 1 1 1 0 0 0 0 5 1 0 0 1 0 0 0 0 6 0 1 1 1 0 0 0 0 7 0 1 1 1 0 0 0 0 8 0 1 1 0 1 0 0 0 9 0 1 1 0 1 0 0 0 10 0 1 1 0 1 0 0 0 11 0 1 1 0 1 0 0 0 12 0 1 0 0 0 1 0 0 13 0 1 0 0 0 1 0 0 14 0 1 1 0 0 1 0 0 15 0 1 1 0 0 1 0 0 16 0 1 0 0 0 0 1 0 17 0 1 1 0 0 0 1 0 18 0 1 1 0 0 0 1 0 19 1 0 1 0 0 0 0 1 20 1 0 1 0 0 0 0 1 Actually, what I did after my post was to treat the chip as a random effect instead of a fixed batch effect (although I though the code in my last post was correct), because I thought the within batch data is not well balanced and applying a mixed model may be safer. There are 11 sig DEGs generated from the mixed model, including the above 10 and 3 sig genes. Please add any thoughts you have so that I can learn more. Thank you very much ! Thanks, Xiayu -----Original Message----- From: Federico Lasa [mailto:felasa@gmail.com] Sent: Friday, August 08, 2014 3:22 PM To: Rao,Xiayu Cc: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] Any problem with the design matrix or the contrasts? Thanks Both a question and a quick suggestion.. For the first case, should/does design <- model.matrix(~0+AR +gender +chip, data=targets) cm<-makeContrasts(ARpos-ARneg, levels=design) produce the same results you have? On Fri, Aug 1, 2014 at 10:07 AM, Rao,Xiayu <xrao at="" mdanderson.org=""> wrote: > Hello, > > I learned from posts in the forum and analyzed my data using the suggested design and contrasts. It turns out there are no sig genes or few in the end. Could you please help check if the design does not fit the data or the contrasts made are incorrect?? > > #the research questions are 1) to compare between pos and neg for AR, and 2) Male.pos vs. Female.pos. > > Treat <- factor(paste(targets$gender,targets$AR,sep=".")) > chip <- factor(targets$chip) > design <- model.matrix(~0+Treat+chip) > colnames(design)[1:4] <- levels(Treat) fit <- lmFit(y,design) > > cm <- makeContrasts(posVSneg=(F.pos+M.pos-F.neg-M.neg)/2, > MposVSFpos=M.pos-F.pos, levels=design) > fit2 <- contrasts.fit(fit,cm) > fit2 <- eBayes(fit2) > topTable(fit2, coef="posVSneg", sort.by="p") #0 sig genes > topTable(fit2, n=20,coef="MposVSFpos", sort.by="p") #4 sig genes > > targets.txt > sample gender AR chip > s1 F pos 1 > s2 F neg 1 > s3 M neg 2 > s4 M pos 2 > s5 F neg 2 > s6 M pos 2 > s7 M pos 2 > s8 M pos 3 > s9 M pos 3 > s10 M pos 3 > s11 M pos 3 > s12 F pos 4 > s13 F pos 4 > s14 M pos 4 > s15 M pos 4 > s16 F pos 5 > s17 M pos 5 > s18 M pos 5 > s19 M neg 6 > s20 M neg 6 > s21 F neg 6 > s22 F pos 6 > s23 F pos 6 > s24 F neg 6 > s25 F pos 6 > s26 F pos 6 > s27 F pos 6 > s28 M neg 6 > > > Thanks, > Xiayu > > [[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
ADD REPLY
0
Entering edit mode
The difference is that chip is treated as a numeric variable in one case and as a factor variable in the other. I believe the second case is more aproppiate. On Aug 8, 2014 4:03 PM, "Rao,Xiayu" <xrao@mdanderson.org> wrote: > Thank you for your kind suggestion, Federico! > > I tried your suggested design, and found the result is different. There > are 10 sig DEGs in the end. > > design <- model.matrix(~0+AR+gender+chip,data=targets) > > design > ARneg ARpos genderM chip > 1 0 1 0 1 > 2 1 0 0 1 > 3 1 0 1 2 > 4 0 1 1 2 > 5 1 0 0 2 > 6 0 1 1 2 > 7 0 1 1 2 > 8 0 1 1 3 > 9 0 1 1 3 > 10 0 1 1 3 > 11 0 1 1 3 > 12 0 1 0 4 > 13 0 1 0 4 > 14 0 1 1 4 > 15 0 1 1 4 > 16 0 1 0 5 > 17 0 1 1 5 > 18 0 1 1 5 > > I also tried this design, which I originally thought would be the same as > yours, but is different. There are 3 sig DEGs in the end. Could you please > explain the cause of the difference ?? > > gender <- factor(targets$gender) > > AR <- factor(targets$AR) > > chip <- factor(targets$chip) > > design <- model.matrix(~0+AR+gender+chip) > > design > ARneg ARpos genderM chip2 chip3 chip4 chip5 chip6 > 1 0 1 0 0 0 0 0 0 > 2 1 0 0 0 0 0 0 0 > 3 1 0 1 1 0 0 0 0 > 4 0 1 1 1 0 0 0 0 > 5 1 0 0 1 0 0 0 0 > 6 0 1 1 1 0 0 0 0 > 7 0 1 1 1 0 0 0 0 > 8 0 1 1 0 1 0 0 0 > 9 0 1 1 0 1 0 0 0 > 10 0 1 1 0 1 0 0 0 > 11 0 1 1 0 1 0 0 0 > 12 0 1 0 0 0 1 0 0 > 13 0 1 0 0 0 1 0 0 > 14 0 1 1 0 0 1 0 0 > 15 0 1 1 0 0 1 0 0 > 16 0 1 0 0 0 0 1 0 > 17 0 1 1 0 0 0 1 0 > 18 0 1 1 0 0 0 1 0 > 19 1 0 1 0 0 0 0 1 > 20 1 0 1 0 0 0 0 1 > > Actually, what I did after my post was to treat the chip as a random > effect instead of a fixed batch effect (although I though the code in my > last post was correct), because I thought the within batch data is not well > balanced and applying a mixed model may be safer. There are 11 sig DEGs > generated from the mixed model, including the above 10 and 3 sig genes. > Please add any thoughts you have so that I can learn more. Thank you very > much ! > > Thanks, > Xiayu > > > > > -----Original Message----- > From: Federico Lasa [mailto:felasa@gmail.com] > Sent: Friday, August 08, 2014 3:22 PM > To: Rao,Xiayu > Cc: bioconductor@stat.math.ethz.ch > Subject: Re: [BioC] Any problem with the design matrix or the contrasts? > Thanks > > Both a question and a quick suggestion.. > > For the first case, should/does > > design <- model.matrix(~0+AR +gender +chip, data=targets) > cm<-makeContrasts(ARpos-ARneg, levels=design) > > produce the same results you have? > > On Fri, Aug 1, 2014 at 10:07 AM, Rao,Xiayu <xrao@mdanderson.org> wrote: > > Hello, > > > > I learned from posts in the forum and analyzed my data using the > suggested design and contrasts. It turns out there are no sig genes or few > in the end. Could you please help check if the design does not fit the data > or the contrasts made are incorrect?? > > > > #the research questions are 1) to compare between pos and neg for AR, > and 2) Male.pos vs. Female.pos. > > > > Treat <- factor(paste(targets$gender,targets$AR,sep=".")) > > chip <- factor(targets$chip) > > design <- model.matrix(~0+Treat+chip) > > colnames(design)[1:4] <- levels(Treat) fit <- lmFit(y,design) > > > > cm <- makeContrasts(posVSneg=(F.pos+M.pos-F.neg-M.neg)/2, > > MposVSFpos=M.pos-F.pos, levels=design) > > fit2 <- contrasts.fit(fit,cm) > > fit2 <- eBayes(fit2) > > topTable(fit2, coef="posVSneg", sort.by="p") #0 sig genes > > topTable(fit2, n=20,coef="MposVSFpos", sort.by="p") #4 sig > genes > > > > targets.txt > > sample gender AR chip > > s1 F pos 1 > > s2 F neg 1 > > s3 M neg 2 > > s4 M pos 2 > > s5 F neg 2 > > s6 M pos 2 > > s7 M pos 2 > > s8 M pos 3 > > s9 M pos 3 > > s10 M pos 3 > > s11 M pos 3 > > s12 F pos 4 > > s13 F pos 4 > > s14 M pos 4 > > s15 M pos 4 > > s16 F pos 5 > > s17 M pos 5 > > s18 M pos 5 > > s19 M neg 6 > > s20 M neg 6 > > s21 F neg 6 > > s22 F pos 6 > > s23 F pos 6 > > s24 F neg 6 > > s25 F pos 6 > > s26 F pos 6 > > s27 F pos 6 > > s28 M neg 6 > > > > > > Thanks, > > Xiayu > > > > [[alternative HTML version deleted]] > > > > _______________________________________________ > > Bioconductor mailing list > > Bioconductor@r-project.org > > https://stat.ethz.ch/mailman/listinfo/bioconductor > > Search the archives: > > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

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