> FDRpvalue<-p.adjust(LimmaFitPvalue,method="fdr") > FDRTPvalue<-p.adjust(TPvalue,method="fdr") > plot(LimmaFit$coefficients[complete.data],-log(FDRTPvalue[complete.data],base=10),type="p",main="Two-Sample t- test",xlab="Mean Difference",ylab="-log10(FDRTPvalue)",ylim=c(0,0.6)) > plot(LimmaFit$coefficients[complete.data],-log(FDRpvalue[complete.data],base=10),type="p",main="Paired t- test",xlab="Mean Difference",ylab="-log10(FDRpvalue)",ylim=c(0,0.6)) FDR Comparisons source("
False Discovery Rate Alternatively, adjust p-values as Following decision making procedure will keep FDR below q *
FDR p-value adjustments > N<-sum(!is.na(LimmaFitPvalue)) > Qvalue<-(N/rank(LimmaFitPvalue))*LimmaFitPvalue > FDRpvalue<-p.adjust(LimmaFitPvalue,method="fdr") > BONFpvalue<-p.adjust(LimmaFitPvalue,method="bonferroni") > All.Sigs<- data.frame(list(p.value=LimmaFitPvalue,Qvalue=Qvalue,FDRpv alue=FDRpvalue,BONFpvalue=BONFpvalue)) > OrderingPvalues<-order(LimmaFitPvalue) > All.Sigs<-All.Sigs[OrderingPvalues,] >
FDR p-value adjustments > All.Sigs[1:10,] p.value Qvalue FDRpvalue BONFpvalue e e e e e e e e e e >
Loess Normalization
Loess Normalization > NickelLoess<-loess(NNBLimmaDataNickel$M[,1]~NNBLimmaDataNickel$A[,1]) > attributes(NickelLoess) $names [1] "n" "fitted" "residuals" "enp" "s" "one.delta" [7] "two.delta" "trace.hat" "divisor" "pars" "kd" "call" [13] "terms" "xnames" "x" "y" "weights" $class [1] "loess" > par(mfrow=c(1,1)) > plotMA(NNBLimmaDataNickel,array=1,zero.weights=F,legend=F) > lines(c(-5,100),c(0,0),lw=5,col="blue") > points(NNBLimmaDataNickel$A[,1],NickelLoess$fitted,col="red")
Loess Normalization > NLNBLimmaDataNickel<-normalizeWithinArrays(NBLimmaDataNickel,method="loess") > par(mfrow=c(1,1)) > plotMA(NLNBLimmaDataNickel,array=1,zero.weights=F,legend=F) > lines(c(-5,100),c(0,0),lw=5,col="blue")
Loess Normalized Analysis > LoessLimmaFit<-lmFit(NLNBLimmaDataNickel,design) > LoessLimmaFitTstat<- abs(LoessLimmaFit$coefficients/(LoessLimmaFit$sigma*LoessLimmaFit$stdev.unscaled)) > LoessLimmaFitPvalue<-2*pt(LoessLimmaFitTstat,LoessLimmaFit$df.residual,lower.tail=FALSE) > LoessFDRpvalue<-p.adjust(LoessLimmaFitPvalue,method="fdr")
Empirical Bayes Estimation > EBayesLoessLimmaFit<-eBayes(LoessLimmaFit) > attributes(EBayesLoessLimmaFit) $names [1] "coefficients" "stdev.unscaled" "sigma" "df.residual" [5] "cov.coefficients" "pivot" "method" "design" [9] "genes" "Amean" "df.prior" "s2.prior" [13] "var.prior" "proportion" "s2.post" "t" [17] "p.value" "lods" "F" "F.p.value" $class [1] "MArrayLM" attr(,"package") [1] "limma" > EBayesFDR<-p.adjust(EBayesLoessLimmaFit$p.value,method="fdr") Homework: Compare "coefficients" for EBayesLoessLimmaFit and LoessLimmaFit
Empirical Bayes Estimation
Pretending That Data is Single Channel Again > LinearModelData<-cbind(NLNBLimmaDataNickel,NLNBLimmaDataNickel) > dim(LinearModelData) [1] > LinearModelData$M[1,] Cy5_Ctl-WT00hr_2_VS_Cy3_Nic-WT72hr_2 Cy5_Nic-WT72hr_3_VS_Cy3_Ctl-WT00hr_3 Cy5_Nic-WT72hr_1_VS_Cy3_Ctl-WT00hr_1 Cy5_Ctl-WT00hr_2_VS_Cy3_Nic- WT72hr_ Cy5_Nic-WT72hr_3_VS_Cy3_Ctl-WT00hr_3 Cy5_Nic-WT72hr_1_VS_Cy3_Ctl-WT00hr_ > LinearModelData$M<-cbind((NLNBLimmaDataNickel$A+NLNBLimmaDataNickel$M/2),NLNBLimmaDataNickel$A-(NLNBLimmaDataNickel$M/2)) > LinearModelData$M[1,] Cy5_Ctl-WT00hr_2_VS_Cy3_Nic-WT72hr_2 Cy5_Nic-WT72hr_3_VS_Cy3_Ctl-WT00hr_3 Cy5_Nic-WT72hr_1_VS_Cy3_Ctl-WT00hr_1 Cy5_Ctl-WT00hr_2_VS_Cy3_Nic-WT72hr_ Cy5_Nic-WT72hr_3_VS_Cy3_Ctl-WT00hr_3 Cy5_Nic-WT72hr_1_VS_Cy3_Ctl-WT00hr_ > This will "split" ratios back into the two channel data We could use original R and G data, but want to make use of loess normalization
Simple Linear Model Statistical Model: Trt j ="Effect due to treatmet j" Ctl for j=1 and Nic for j=2 x ij = log-intensity for replicate i and treatment j, where i=1,2,3 and j=1,2 Parameters are estimated based on the General Linear Model Framework and for now it just turns out that We are interested if Trt 2 -Trt 1
Describing a Linear Model to Limma Statistical Model: Design Matrix: > designMatrix<-cbind(Ctl=c(1,0,0,0,1,1),Nic=c(0,1,1,1,0,0)) > designMatrix Ctl Nic [1,] 1 0 [2,] 0 1 [3,] 0 1 [4,] 0 1 [5,] 1 0 [6,] 1 0 > contrast<-c(-1,1)
Describing a Linear Model to Limma Statistical Model: > FitLM<-lmFit(LinearModelData,designMatrix) > FitContrast<-contrasts.fit(FitLM,contrast) > attributes(FitContrast) $names [1] "coefficients" "stdev.unscaled" "sigma" "df.residual" "cov.coefficients" "method" "design" [8] "genes" "Amean" "contrasts" $class [1] "MArrayLM" attr(,"package") [1] "limma" > ContrastTstat<- abs(FitContrast$coefficients)/(FitContrast$sigma*FitContrast$stdev.unscaled) > ContrastPvalue<-2*pt(ContrastTstat,FitContrast$df.residual,lower.tail=FALSE)
Alternative Formulations of the Two-way ANOVA No-intercept Model Parameter Estimates Gets complicated Regardless of how the model is parametrized certain parameters remain unchanged (Trt 2 -Trt 1 ) In this sense all formulations are equivalent Null Hypotheses Null Distributions