R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("multtest-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('multtest') Loading required package: survival Loading required package: splines > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "MTP-class" > > ### * MTP-class > > flush(stderr()); flush(stdout()) > > ### Name: MTP-class > ### Title: Class "MTP", classes and methods for multiple testing procedure > ### output > ### Aliases: MTP-class > ### Keywords: classes > > ### ** Examples > > ## See MTP function: ? MTP > > > > cleanEx(); ..nameEx <- "MTP" > > ### * MTP > > flush(stderr()); flush(stdout()) > > ### Name: MTP > ### Title: A function to perform resampling-based multiple hypothesis > ### testing > ### Aliases: MTP > ### Keywords: htest > > ### ** Examples > > > #data > set.seed(99) > data<-matrix(rnorm(90),nr=9) > group<-c(rep(1,5),rep(0,5)) > > #fwer control with bootstrap null distribution (B=100 for speed) > m1<-MTP(X=data,Y=group,alternative="less",B=100,method="sd.minP") running bootstrap... iteration = 100 > print(m1) Multiple Testing Procedure Object of class: MTP sample size = 10 number of hypotheses = 9 test statistics = t.twosamp.unequalvar type I error rate = fwer nominal level alpha = 0.05 multiple testing procedure = sd.minP Call: MTP(X = data, Y = group, alternative = "less", B = 100, method = "sd.minP") Slots: Class Mode Length Dimension statistic numeric numeric 9 estimate numeric numeric 9 sampsize integer numeric 1 rawp numeric numeric 9 adjp numeric numeric 9 conf.reg array logical 0 0,0,0 cutoff matrix logical 0 0,0 reject matrix logical 9 9,1 nulldist matrix numeric 900 9,100 call call call 6 seed integer numeric 0 > summary(m1) MTP: sd.minP Type I error rate: fwer Level Rejections 1 0.05 1 Min. 1st Qu. Median Mean 3rd Qu. Max. adjp 0.0400 0.3100 0.3200 0.5656 0.9900 0.990 rawp 0.0100 0.0700 0.0900 0.3889 0.7700 0.990 statistic -1.8180 -1.2140 -0.9126 -0.2619 0.5916 2.696 estimate -0.9052 -0.7545 -0.4827 -0.1838 0.2746 1.252 > par(mfrow=c(2,2)) > plot(m1,top=9) > > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "boot.resample" > > ### * boot.resample > > flush(stderr()); flush(stdout()) > > ### Name: boot.resample > ### Title: Non-parametric bootstrap resampling function in package > ### `multtest' > ### Aliases: boot.resample > ### Keywords: manip internal > > ### ** Examples > > > #data example: ALL data set > set.seed(99) > data<-matrix(rnorm(90),nr=9) > > #closure > ttest<-meanX(psi0=0,na.rm=TRUE,standardize=TRUE,alternative="two.sided",robust=FALSE) > > #test statistics > obs<-get.Tn(X=data,stat.closure=ttest,W=NULL) > > #bootstrap null distribution (B=100 for speed) > nulldistn<-boot.resample(X=data,W=NULL,stat.closure=ttest,B=100,theta0=0,tau0=1) running bootstrap... iteration = 100 > > #unadjusted p-values > rawp<-apply((obs[1,]/obs[2,])<=nulldistn,1,mean) > sum(rawp<=0.01) [1] 1 > > > > > cleanEx(); ..nameEx <- "fwer2gfwer" > > ### * fwer2gfwer > > flush(stderr()); flush(stdout()) > > ### Name: fwer2gfwer > ### Title: Function to compute augmentation MTP adjusted p-values > ### Aliases: fwer2gfwer fwer2tppfp fwer2fdr > ### Keywords: htest internal > > ### ** Examples > > > data<-matrix(rnorm(200),nr=20) > group<-c(rep(0,5),rep(1,5)) > fwer.mtp<-MTP(X=data,Y=group) running bootstrap... iteration = 100 200 300 400 500 600 700 800 900 1000 > fwer.adjp<-fwer.mtp@adjp > gfwer.adjp<-fwer2gfwer(adjp=fwer.adjp,k=c(1,5,10)) > compare.gfwer<-cbind(fwer.adjp,gfwer.adjp) > mt.plot(adjp=compare.gfwer,teststat=fwer.mtp@statistic,proc=c("gFWER(0)","gFWER(1)","gFWER(5)","gFWER(10)"),col=1:4,lty=1:4) > title("Comparison of Single-step MaxT gFWER Controlling Methods") > > > > > cleanEx(); ..nameEx <- "get.index" > > ### * get.index > > flush(stderr()); flush(stdout()) > > ### Name: get.index > ### Title: Function to compute indices for ordering hypotheses in Package > ### 'multtest' > ### Aliases: get.index > ### Keywords: htest internal > > ### ** Examples > > data<-matrix(rnorm(200),nr=20) > mtp<-MTP(X=data,test="t.onesamp") running bootstrap... iteration = 100 200 300 400 500 600 700 800 900 1000 > index<-get.index(adjp=mtp@adjp,rawp=mtp@rawp,stat=mtp@statistic) > mtp@statistic[index] [1] -0.62383091 0.61959029 0.54996909 0.45979913 0.36310805 0.32177655 [7] -0.28896780 -0.28343768 0.26179136 0.21265993 -0.20977124 -0.17197359 [13] -0.15690916 0.13675479 -0.11772816 -0.11483575 -0.06494253 0.03120672 [19] 0.01349878 -0.01032543 > mtp@estimate[index] [1] -0.59769844 0.38449858 0.52070416 0.32496404 0.38942266 0.26209966 [7] -0.16498298 -0.18576650 0.27141328 0.24321005 -0.23988579 -0.17167561 [13] -0.18859576 0.12377288 -0.14162717 -0.11010342 -0.03883344 0.02916605 [19] 0.01102713 -0.01031648 > apply(data[index,],1,mean) [1] -0.59769844 0.38449858 0.52070416 0.32496404 0.38942266 0.26209966 [7] -0.16498298 -0.18576650 0.27141328 0.24321005 -0.23988579 -0.17167561 [13] -0.18859576 0.12377288 -0.14162717 -0.11010342 -0.03883344 0.02916605 [19] 0.01102713 -0.01031648 > > > > cleanEx(); ..nameEx <- "meanX" > > ### * meanX > > flush(stderr()); flush(stdout()) > > ### Name: meanX > ### Title: Functions to create test statistic closures and apply them to > ### data > ### Aliases: meanX diffmeanX FX blockFX lmX lmY coxY get.Tn > ### Keywords: htest internal > > ### ** Examples > > data<-matrix(rnorm(200),nr=20) > ttest<-meanX(psi0=0,na.rm=TRUE,standardize=TRUE,alternative="two.sided",robust=FALSE) > obs<-wapply(data,1,ttest,W=NULL) > statistics<-obs[1,]*obs[3,]/obs[2,] > statistics [1] -0.15690916 0.61959029 0.03120672 -0.20977124 -0.28343768 0.26179136 [7] 0.36310805 -0.01032543 -0.28896780 0.21265993 0.54996909 -0.06494253 [13] 0.45979913 -0.62383091 -0.11772816 -0.17197359 0.01349878 -0.11483575 [19] 0.13675479 0.32177655 > > > > cleanEx(); ..nameEx <- "mt.maxT" > > ### * mt.maxT > > flush(stderr()); flush(stdout()) > > ### Name: mt.maxT > ### Title: Step-down maxT and minP multiple testing procedures > ### Aliases: mt.maxT mt.minP > ### Keywords: htest > > ### ** Examples > > # Gene expression data from Golub et al. (1999) > # To reduce computation time and for illustrative purposes, we condider only > # the first 100 genes and use the default of B=10,000 permutations. > # In general, one would need a much larger number of permutations > # for microarray data. > > data(golub) > smallgd<-golub[1:100,] > classlabel<-golub.cl > > # Permutation unadjusted p-values and adjusted p-values > # for maxT and minP procedures with Welch t-statistics > resT<-mt.maxT(smallgd,classlabel) b=100 b=200 b=300 b=400 b=500 b=600 b=700 b=800 b=900 b=1000 b=1100 b=1200 b=1300 b=1400 b=1500 b=1600 b=1700 b=1800 b=1900 b=2000 b=2100 b=2200 b=2300 b=2400 b=2500 b=2600 b=2700 b=2800 b=2900 b=3000 b=3100 b=3200 b=3300 b=3400 b=3500 b=3600 b=3700 b=3800 b=3900 b=4000 b=4100 b=4200 b=4300 b=4400 b=4500 b=4600 b=4700 b=4800 b=4900 b=5000 b=5100 b=5200 b=5300 b=5400 b=5500 b=5600 b=5700 b=5800 b=5900 b=6000 b=6100 b=6200 b=6300 b=6400 b=6500 b=6600 b=6700 b=6800 b=6900 b=7000 b=7100 b=7200 b=7300 b=7400 b=7500 b=7600 b=7700 b=7800 b=7900 b=8000 b=8100 b=8200 b=8300 b=8400 b=8500 b=8600 b=8700 b=8800 b=8900 b=9000 b=9100 b=9200 b=9300 b=9400 b=9500 b=9600 b=9700 b=9800 b=9900 b=10000 > resP<-mt.minP(smallgd,classlabel) B=10000 b=100 b=200 b=300 b=400 b=500 b=600 b=700 b=800 b=900 b=1000 b=1100 b=1200 b=1300 b=1400 b=1500 b=1600 b=1700 b=1800 b=1900 b=2000 b=2100 b=2200 b=2300 b=2400 b=2500 b=2600 b=2700 b=2800 b=2900 b=3000 b=3100 b=3200 b=3300 b=3400 b=3500 b=3600 b=3700 b=3800 b=3900 b=4000 b=4100 b=4200 b=4300 b=4400 b=4500 b=4600 b=4700 b=4800 b=4900 b=5000 b=5100 b=5200 b=5300 b=5400 b=5500 b=5600 b=5700 b=5800 b=5900 b=6000 b=6100 b=6200 b=6300 b=6400 b=6500 b=6600 b=6700 b=6800 b=6900 b=7000 b=7100 b=7200 b=7300 b=7400 b=7500 b=7600 b=7700 b=7800 b=7900 b=8000 b=8100 b=8200 b=8300 b=8400 b=8500 b=8600 b=8700 b=8800 b=8900 b=9000 b=9100 b=9200 b=9300 b=9400 b=9500 b=9600 b=9700 b=9800 b=9900 b=10000 r=1 r=2 r=3 r=4 r=5 r=6 r=7 r=8 r=9 r=10 r=11 r=12 r=13 r=14 r=15 r=16 r=17 r=18 r=19 r=20 r=21 r=22 r=23 r=24 r=25 r=26 r=27 r=28 r=29 r=30 r=31 r=32 r=33 r=34 r=35 r=36 r=37 r=38 r=39 r=40 r=41 r=42 r=43 r=44 r=45 r=46 r=47 r=48 r=49 r=50 r=51 r=52 r=53 r=54 r=55 r=56 r=57 r=58 r=59 r=60 r=61 r=62 r=63 r=64 r=65 r=66 r=67 r=68 r=69 r=70 r=71 r=72 r=73 r=74 r=75 r=76 r=77 r=78 r=79 r=80 r=81 r=82 r=83 r=84 r=85 r=86 r=87 r=88 r=89 r=90 r=91 r=92 r=93 r=94 r=95 r=96 r=97 r=98 r=99 r=100 > rawp<-resT$rawp[order(resT$index)] > teststat<-resT$teststat[order(resT$index)] > > # Plot results and compare to Bonferroni procedure > bonf<-mt.rawp2adjp(rawp, proc=c("Bonferroni")) > allp<-cbind(rawp, bonf$adjp[order(bonf$index),2], resT$adjp[order(resT$index)],resP$adjp[order(resP$index)]) > > mt.plot(allp, teststat, plottype="rvsa", proc=c("rawp","Bonferroni","maxT","minP"),leg=c(0.7,50),lty=1,col=1:4,lwd=2) > mt.plot(allp, teststat, plottype="pvsr", proc=c("rawp","Bonferroni","maxT","minP"),leg=c(60,0.2),lty=1,col=1:4,lwd=2) > mt.plot(allp, teststat, plottype="pvst", proc=c("rawp","Bonferroni","maxT","minP"),leg=c(-6,0.6),pch=16,col=1:4) > > # Permutation adjusted p-values for minP procedure with F-statistics (like equal variance t-statistics) > mt.minP(smallgd,classlabel,test="f",fixed.seed.sampling="n") B=10000 We're doing 10000 random permutations b=100 b=200 b=300 b=400 b=500 b=600 b=700 b=800 b=900 b=1000 b=1100 b=1200 b=1300 b=1400 b=1500 b=1600 b=1700 b=1800 b=1900 b=2000 b=2100 b=2200 b=2300 b=2400 b=2500 b=2600 b=2700 b=2800 b=2900 b=3000 b=3100 b=3200 b=3300 b=3400 b=3500 b=3600 b=3700 b=3800 b=3900 b=4000 b=4100 b=4200 b=4300 b=4400 b=4500 b=4600 b=4700 b=4800 b=4900 b=5000 b=5100 b=5200 b=5300 b=5400 b=5500 b=5600 b=5700 b=5800 b=5900 b=6000 b=6100 b=6200 b=6300 b=6400 b=6500 b=6600 b=6700 b=6800 b=6900 b=7000 b=7100 b=7200 b=7300 b=7400 b=7500 b=7600 b=7700 b=7800 b=7900 b=8000 b=8100 b=8200 b=8300 b=8400 b=8500 b=8600 b=8700 b=8800 b=8900 b=9000 b=9100 b=9200 b=9300 b=9400 b=9500 b=9600 b=9700 b=9800 b=9900 b=10000 r=1 r=2 r=3 r=4 r=5 r=6 r=7 r=8 r=9 r=10 r=11 r=12 r=13 r=14 r=15 r=16 r=17 r=18 r=19 r=20 r=21 r=22 r=23 r=24 r=25 r=26 r=27 r=28 r=29 r=30 r=31 r=32 r=33 r=34 r=35 r=36 r=37 r=38 r=39 r=40 r=41 r=42 r=43 r=44 r=45 r=46 r=47 r=48 r=49 r=50 r=51 r=52 r=53 r=54 r=55 r=56 r=57 r=58 r=59 r=60 r=61 r=62 r=63 r=64 r=65 r=66 r=67 r=68 r=69 r=70 r=71 r=72 r=73 r=74 r=75 r=76 r=77 r=78 r=79 r=80 r=81 r=82 r=83 r=84 r=85 r=86 r=87 r=88 r=89 r=90 r=91 r=92 r=93 r=94 r=95 r=96 r=97 r=98 r=99 r=100 index teststat rawp adjp plower 68 68 3.062227e+01 0.0001 0.0093 0.0001 96 96 2.766694e+01 0.0001 0.0093 0.0001 13 13 2.414014e+01 0.0001 0.0093 0.0001 66 66 1.861284e+01 0.0002 0.0177 0.0093 11 11 2.008664e+01 0.0003 0.0256 0.0176 56 56 2.001496e+01 0.0003 0.0256 0.0176 12 12 1.844169e+01 0.0005 0.0413 0.0338 62 62 1.444177e+01 0.0005 0.0413 0.0338 23 23 1.324712e+01 0.0008 0.0634 0.0562 74 74 1.250343e+01 0.0011 0.0838 0.0774 81 81 1.289048e+01 0.0012 0.0893 0.0828 78 78 1.228135e+01 0.0016 0.1143 0.1084 55 55 9.224597e+00 0.0044 0.2638 0.2589 32 32 8.844296e+00 0.0048 0.2804 0.2756 36 36 8.519580e+00 0.0053 0.3011 0.2967 67 67 8.196699e+00 0.0069 0.3630 0.3590 82 82 7.311714e+00 0.0103 0.4767 0.4735 50 50 7.099773e+00 0.0103 0.4767 0.4735 84 84 6.217233e+00 0.0172 0.6421 0.6400 1 1 6.260538e+00 0.0176 0.6498 0.6471 35 35 5.644936e+00 0.0239 0.7471 0.7457 18 18 5.532228e+00 0.0254 0.7613 0.7605 39 39 4.759517e+00 0.0301 0.8092 0.8079 60 60 4.793357e+00 0.0366 0.8623 0.8617 79 79 4.557838e+00 0.0372 0.8625 0.8621 25 25 4.545975e+00 0.0388 0.8713 0.8706 59 59 4.426178e+00 0.0390 0.8713 0.8706 26 26 4.851972e+00 0.0413 0.8844 0.8841 63 63 4.210565e+00 0.0472 0.9109 0.9107 51 51 4.109967e+00 0.0491 0.9171 0.9164 43 43 3.958032e+00 0.0580 0.9430 0.9427 20 20 3.449932e+00 0.0723 0.9710 0.9708 77 77 3.103298e+00 0.0849 0.9843 0.9843 72 72 2.852188e+00 0.0889 0.9854 0.9854 100 100 2.951363e+00 0.0964 0.9893 0.9892 47 47 2.773701e+00 0.1081 0.9935 0.9935 48 48 2.617835e+00 0.1115 0.9942 0.9941 73 73 2.619894e+00 0.1172 0.9951 0.9951 40 40 2.311915e+00 0.1387 0.9988 0.9988 29 29 2.241490e+00 0.1436 0.9988 0.9988 41 41 2.304974e+00 0.1440 0.9988 0.9988 53 53 2.167377e+00 0.1475 0.9988 0.9988 89 89 2.061347e+00 0.1552 0.9988 0.9988 17 17 2.109530e+00 0.1564 0.9988 0.9988 49 49 1.967708e+00 0.1878 0.9995 0.9995 83 83 1.822895e+00 0.1920 1.0000 1.0000 21 21 1.666260e+00 0.2043 1.0000 1.0000 37 37 1.654224e+00 0.2092 1.0000 1.0000 46 46 1.540901e+00 0.2270 1.0000 1.0000 64 64 1.467839e+00 0.2349 1.0000 1.0000 5 5 1.408085e+00 0.2434 1.0000 1.0000 90 90 1.383139e+00 0.2567 1.0000 1.0000 34 34 1.326855e+00 0.2605 1.0000 1.0000 2 2 1.336722e+00 0.2617 1.0000 1.0000 61 61 1.275653e+00 0.2726 1.0000 1.0000 6 6 1.192989e+00 0.2824 1.0000 1.0000 75 75 1.193419e+00 0.2888 1.0000 1.0000 69 69 8.536810e-01 0.3591 1.0000 1.0000 98 98 8.539816e-01 0.3598 1.0000 1.0000 44 44 8.372706e-01 0.3679 1.0000 1.0000 42 42 8.429247e-01 0.3693 1.0000 1.0000 94 94 7.328465e-01 0.4011 1.0000 1.0000 54 54 5.968788e-01 0.4550 1.0000 1.0000 65 65 5.502305e-01 0.4609 1.0000 1.0000 80 80 6.556086e-01 0.4856 1.0000 1.0000 92 92 4.707996e-01 0.4927 1.0000 1.0000 70 70 4.341107e-01 0.5066 1.0000 1.0000 45 45 4.607621e-01 0.5130 1.0000 1.0000 93 93 3.967730e-01 0.5378 1.0000 1.0000 24 24 3.947238e-01 0.5462 1.0000 1.0000 71 71 3.647944e-01 0.5533 1.0000 1.0000 97 97 3.576693e-01 0.5543 1.0000 1.0000 95 95 3.253561e-01 0.5847 1.0000 1.0000 57 57 3.125110e-01 0.5958 1.0000 1.0000 88 88 3.823742e-01 0.6123 1.0000 1.0000 30 30 2.893964e-01 0.6168 1.0000 1.0000 85 85 2.472995e-01 0.6260 1.0000 1.0000 52 52 2.110735e-01 0.6531 1.0000 1.0000 22 22 2.100324e-01 0.6611 1.0000 1.0000 38 38 1.990003e-01 0.6621 1.0000 1.0000 7 7 2.442059e-01 0.6774 1.0000 1.0000 16 16 1.457034e-01 0.6919 1.0000 1.0000 27 27 1.360907e-01 0.7165 1.0000 1.0000 19 19 1.192702e-01 0.7302 1.0000 1.0000 14 14 1.242731e-01 0.7312 1.0000 1.0000 8 8 1.341616e-01 0.7683 1.0000 1.0000 33 33 7.460349e-02 0.7838 1.0000 1.0000 4 4 7.434216e-02 0.7897 1.0000 1.0000 31 31 2.707073e-02 0.8675 1.0000 1.0000 76 76 4.698657e-02 0.8751 1.0000 1.0000 15 15 2.370482e-02 0.8796 1.0000 1.0000 91 91 1.835717e-02 0.8903 1.0000 1.0000 99 99 1.663129e-02 0.8979 1.0000 1.0000 3 3 1.209703e-02 0.9128 1.0000 1.0000 86 86 4.653993e-03 0.9479 1.0000 1.0000 10 10 8.231442e-03 0.9585 1.0000 1.0000 28 28 2.693274e-03 0.9626 1.0000 1.0000 58 58 7.484439e-04 0.9760 1.0000 1.0000 87 87 9.860035e-05 0.9915 1.0000 1.0000 9 9 1.257922e-04 0.9932 1.0000 1.0000 > > # Note that the test statistics used in the examples below are not appropriate > # for the Golub et al. data. The sole purpose of these examples is to > # demonstrate the use of the mt.maxT and mt.minP functions. > > # Permutation adjusted p-values for maxT procedure with paired t-statistics > classlabel<-rep(c(0,1),19) > mt.maxT(smallgd,classlabel,test="pairt") We're doing 10000 random permutations b=100 b=200 b=300 b=400 b=500 b=600 b=700 b=800 b=900 b=1000 b=1100 b=1200 b=1300 b=1400 b=1500 b=1600 b=1700 b=1800 b=1900 b=2000 b=2100 b=2200 b=2300 b=2400 b=2500 b=2600 b=2700 b=2800 b=2900 b=3000 b=3100 b=3200 b=3300 b=3400 b=3500 b=3600 b=3700 b=3800 b=3900 b=4000 b=4100 b=4200 b=4300 b=4400 b=4500 b=4600 b=4700 b=4800 b=4900 b=5000 b=5100 b=5200 b=5300 b=5400 b=5500 b=5600 b=5700 b=5800 b=5900 b=6000 b=6100 b=6200 b=6300 b=6400 b=6500 b=6600 b=6700 b=6800 b=6900 b=7000 b=7100 b=7200 b=7300 b=7400 b=7500 b=7600 b=7700 b=7800 b=7900 b=8000 b=8100 b=8200 b=8300 b=8400 b=8500 b=8600 b=8700 b=8800 b=8900 b=9000 b=9100 b=9200 b=9300 b=9400 b=9500 b=9600 b=9700 b=9800 b=9900 b=10000 index teststat rawp adjp 96 96 -2.60421977 0.0173 0.6974 59 59 -2.33755545 0.0289 0.8673 23 23 -2.20387309 0.0397 0.9302 27 27 -2.03969281 0.0558 0.9773 99 99 -2.00108376 0.0604 0.9820 63 63 -1.93588894 0.0681 0.9891 53 53 -1.86166565 0.0849 0.9940 95 95 -1.82033275 0.0855 0.9955 30 30 1.72770024 0.0983 0.9984 32 32 1.66180749 0.0912 0.9996 1 1 -1.60285470 0.1531 0.9998 41 41 1.56481848 0.1345 0.9998 100 100 1.56357062 0.1335 0.9998 52 52 1.46843667 0.1529 0.9999 83 83 -1.41707550 0.1751 1.0000 5 5 -1.37475720 0.1751 1.0000 4 4 -1.35478834 0.1862 1.0000 49 49 -1.31527878 0.2161 1.0000 73 73 1.28332034 0.2216 1.0000 34 34 1.28278125 0.2144 1.0000 37 37 1.27848786 0.2176 1.0000 80 80 -1.25044618 0.3160 1.0000 62 62 -1.23821967 0.2267 1.0000 65 65 -1.22051990 0.2393 1.0000 22 22 -1.20045311 0.2528 1.0000 2 2 -1.19476921 0.2537 1.0000 88 88 -1.15100480 0.2965 1.0000 40 40 1.11350723 0.2844 1.0000 76 76 1.09589109 0.3326 1.0000 55 55 -1.08856240 0.2886 1.0000 33 33 -1.08221870 0.2976 1.0000 79 79 -1.07886266 0.2907 1.0000 60 60 1.07041860 0.2918 1.0000 67 67 1.05377621 0.3205 1.0000 6 6 -1.04876563 0.3028 1.0000 90 90 1.04870681 0.3472 1.0000 10 10 1.04390457 0.3755 1.0000 81 81 -1.01552853 0.3271 1.0000 3 3 -1.01184475 0.3355 1.0000 78 78 -0.99690722 0.3521 1.0000 20 20 0.98207112 0.3354 1.0000 9 9 0.97052584 0.3904 1.0000 25 25 -0.92433717 0.3686 1.0000 66 66 -0.90195472 0.3829 1.0000 38 38 0.88272533 0.3847 1.0000 17 17 -0.87506967 0.3920 1.0000 72 72 0.86436963 0.4259 1.0000 12 12 -0.85800235 0.4065 1.0000 21 21 0.82915343 0.4088 1.0000 64 64 -0.82169371 0.4240 1.0000 68 68 0.78825137 0.4348 1.0000 7 7 0.73145793 0.5835 1.0000 58 58 -0.72586790 0.4780 1.0000 74 74 -0.71613131 0.4788 1.0000 94 94 -0.71402074 0.4883 1.0000 50 50 0.70002505 0.5020 1.0000 42 42 0.66777708 0.5113 1.0000 31 31 0.66426220 0.5172 1.0000 54 54 0.64826876 0.5189 1.0000 8 8 0.61535598 0.6570 1.0000 75 75 -0.61066078 0.5424 1.0000 82 82 -0.59674635 0.5528 1.0000 29 29 0.56224784 0.5700 1.0000 70 70 -0.55543071 0.5849 1.0000 14 14 -0.53873437 0.5901 1.0000 56 56 0.49496778 0.6381 1.0000 19 19 0.47968574 0.6318 1.0000 85 85 -0.47556264 0.6396 1.0000 13 13 -0.45748006 0.6441 1.0000 93 93 -0.44832518 0.6580 1.0000 86 86 -0.44748833 0.6615 1.0000 35 35 0.42487123 0.6674 1.0000 46 46 0.40376554 0.6929 1.0000 87 87 -0.39111111 0.7035 1.0000 48 48 -0.39058601 0.7004 1.0000 57 57 0.38658911 0.7077 1.0000 18 18 0.38121040 0.7093 1.0000 98 98 0.31129095 0.7850 1.0000 28 28 -0.30278045 0.7554 1.0000 71 71 0.29255719 0.7725 1.0000 26 26 0.26414778 0.7928 1.0000 45 45 0.25676230 0.7955 1.0000 97 97 0.23947865 0.8200 1.0000 77 77 0.22309752 0.8310 1.0000 44 44 0.20631066 0.8434 1.0000 47 47 -0.19189123 0.8552 1.0000 24 24 0.18303022 0.8548 1.0000 11 11 -0.18189038 0.8503 1.0000 92 92 -0.16398790 0.8693 1.0000 69 69 0.14962497 0.8815 1.0000 16 16 0.14437956 0.8852 1.0000 36 36 -0.11570229 0.9157 1.0000 43 43 0.11313815 0.9091 1.0000 84 84 -0.11041616 0.9147 1.0000 89 89 -0.08497806 0.9389 1.0000 61 61 -0.07314702 0.9498 1.0000 15 15 -0.05690673 0.9533 1.0000 39 39 -0.02810173 0.9777 1.0000 51 51 0.02746677 0.9785 1.0000 91 91 0.01297850 0.9897 1.0000 > > # Permutation adjusted p-values for maxT procedure with block F-statistics > classlabel<-rep(0:18,2) > mt.maxT(smallgd,classlabel,test="blockf",side="upper") b=100 b=200 b=300 b=400 b=500 b=600 b=700 b=800 b=900 b=1000 b=1100 b=1200 b=1300 b=1400 b=1500 b=1600 b=1700 b=1800 b=1900 b=2000 b=2100 b=2200 b=2300 b=2400 b=2500 b=2600 b=2700 b=2800 b=2900 b=3000 b=3100 b=3200 b=3300 b=3400 b=3500 b=3600 b=3700 b=3800 b=3900 b=4000 b=4100 b=4200 b=4300 b=4400 b=4500 b=4600 b=4700 b=4800 b=4900 b=5000 b=5100 b=5200 b=5300 b=5400 b=5500 b=5600 b=5700 b=5800 b=5900 b=6000 b=6100 b=6200 b=6300 b=6400 b=6500 b=6600 b=6700 b=6800 b=6900 b=7000 b=7100 b=7200 b=7300 b=7400 b=7500 b=7600 b=7700 b=7800 b=7900 b=8000 b=8100 b=8200 b=8300 b=8400 b=8500 b=8600 b=8700 b=8800 b=8900 b=9000 b=9100 b=9200 b=9300 b=9400 b=9500 b=9600 b=9700 b=9800 b=9900 b=10000 index teststat rawp adjp 18 18 3.6139699 0.0055 0.3898 21 21 2.7690759 0.0178 0.7818 64 64 2.7146480 0.0152 0.8021 29 29 2.3893531 0.0407 0.9283 98 98 2.3810108 0.0319 0.9283 83 83 2.3519292 0.0312 0.9330 44 44 2.2689744 0.0478 0.9530 19 19 2.1389482 0.0680 0.9750 62 62 2.1364820 0.0399 0.9752 27 27 2.0297403 0.0724 0.9871 13 13 1.9211264 0.0422 0.9945 93 93 1.8361003 0.1051 0.9973 38 38 1.7803992 0.0584 0.9986 77 77 1.7608017 0.1258 0.9989 53 53 1.7561125 0.1268 0.9989 86 86 1.7033746 0.1436 0.9996 63 63 1.5659623 0.1688 0.9999 51 51 1.5592634 0.1841 0.9999 35 35 1.5577416 0.1799 0.9999 15 15 1.5164586 0.1989 0.9999 28 28 1.5142189 0.1999 0.9999 99 99 1.5009710 0.1673 0.9999 70 70 1.4769979 0.2120 1.0000 3 3 1.4728588 0.2064 1.0000 17 17 1.4702197 0.2185 1.0000 94 94 1.4531532 0.2200 1.0000 39 39 1.3891276 0.2385 1.0000 79 79 1.3788664 0.2644 1.0000 8 8 1.3648830 0.1446 1.0000 24 24 1.3554613 0.2696 1.0000 5 5 1.3275549 0.2808 1.0000 42 42 1.2846011 0.2968 1.0000 6 6 1.2638410 0.3223 1.0000 26 26 1.2510375 0.1055 1.0000 14 14 1.2499650 0.3258 1.0000 95 95 1.2425320 0.3128 1.0000 10 10 1.2378640 0.1740 1.0000 73 73 1.2365865 0.3282 1.0000 9 9 1.2326967 0.2389 1.0000 55 55 1.2179523 0.3267 1.0000 7 7 1.1926289 0.2933 1.0000 37 37 1.1895677 0.3625 1.0000 4 4 1.1871576 0.3701 1.0000 65 65 1.1810075 0.3603 1.0000 90 90 1.1519504 0.2656 1.0000 54 54 1.1287818 0.3973 1.0000 20 20 1.1102820 0.4133 1.0000 43 43 1.1078936 0.4100 1.0000 33 33 1.0938577 0.4244 1.0000 41 41 1.0874277 0.4142 1.0000 12 12 1.0770652 0.3410 1.0000 85 85 1.0766656 0.4346 1.0000 57 57 1.0723152 0.4193 1.0000 2 2 1.0550416 0.3916 1.0000 58 58 1.0520557 0.4460 1.0000 49 49 1.0244823 0.4148 1.0000 67 67 1.0242288 0.4190 1.0000 100 100 1.0181612 0.4869 1.0000 50 50 1.0165300 0.4971 1.0000 76 76 1.0157120 0.3911 1.0000 61 61 1.0074150 0.4062 1.0000 74 74 0.9926239 0.5074 1.0000 92 92 0.9924591 0.5022 1.0000 59 59 0.9780074 0.4880 1.0000 97 97 0.9653883 0.5318 1.0000 34 34 0.9646748 0.5365 1.0000 71 71 0.9562545 0.5319 1.0000 87 87 0.9343956 0.5586 1.0000 45 45 0.9339340 0.5403 1.0000 47 47 0.9246263 0.5738 1.0000 68 68 0.9119733 0.5681 1.0000 78 78 0.9041381 0.5987 1.0000 1 1 0.8965092 0.5096 1.0000 81 81 0.8838244 0.6069 1.0000 46 46 0.8785220 0.6191 1.0000 80 80 0.8675999 0.6966 1.0000 60 60 0.8666959 0.6139 1.0000 88 88 0.8547663 0.6962 1.0000 48 48 0.8542449 0.6552 1.0000 72 72 0.8476884 0.6004 1.0000 52 52 0.8319301 0.6467 1.0000 32 32 0.8255257 0.6724 1.0000 75 75 0.7917817 0.6682 1.0000 69 69 0.7809722 0.6915 1.0000 36 36 0.7596911 0.7243 1.0000 22 22 0.7514488 0.7913 1.0000 66 66 0.7177759 0.7831 1.0000 30 30 0.6982564 0.8081 1.0000 84 84 0.6909243 0.7686 1.0000 25 25 0.6737118 0.7855 1.0000 31 31 0.6707505 0.8289 1.0000 82 82 0.6556963 0.8166 1.0000 96 96 0.6004815 0.8710 1.0000 91 91 0.5575354 0.8871 1.0000 89 89 0.5181634 0.9658 1.0000 16 16 0.5119585 0.9126 1.0000 56 56 0.4338079 0.9632 1.0000 11 11 0.4296084 0.9604 1.0000 40 40 0.3837019 0.9714 1.0000 23 23 0.2610202 0.9963 1.0000 > > > > > cleanEx(); ..nameEx <- "mt.plot" > > ### * mt.plot > > flush(stderr()); flush(stdout()) > > ### Name: mt.plot > ### Title: Plotting results from multiple testing procedures > ### Aliases: mt.plot > ### Keywords: hplot > > ### ** Examples > > # Gene expression data from Golub et al. (1999) > # To reduce computation time and for illustrative purposes, we condider only > # the first 100 genes and use the default of B=10,000 permutations. > # In general, one would need a much larger number of permutations > # for microarray data. > > data(golub) > smallgd<-golub[1:100,] > classlabel<-golub.cl > > # Permutation unadjusted p-values and adjusted p-values for maxT procedure > res1<-mt.maxT(smallgd,classlabel) b=100 b=200 b=300 b=400 b=500 b=600 b=700 b=800 b=900 b=1000 b=1100 b=1200 b=1300 b=1400 b=1500 b=1600 b=1700 b=1800 b=1900 b=2000 b=2100 b=2200 b=2300 b=2400 b=2500 b=2600 b=2700 b=2800 b=2900 b=3000 b=3100 b=3200 b=3300 b=3400 b=3500 b=3600 b=3700 b=3800 b=3900 b=4000 b=4100 b=4200 b=4300 b=4400 b=4500 b=4600 b=4700 b=4800 b=4900 b=5000 b=5100 b=5200 b=5300 b=5400 b=5500 b=5600 b=5700 b=5800 b=5900 b=6000 b=6100 b=6200 b=6300 b=6400 b=6500 b=6600 b=6700 b=6800 b=6900 b=7000 b=7100 b=7200 b=7300 b=7400 b=7500 b=7600 b=7700 b=7800 b=7900 b=8000 b=8100 b=8200 b=8300 b=8400 b=8500 b=8600 b=8700 b=8800 b=8900 b=9000 b=9100 b=9200 b=9300 b=9400 b=9500 b=9600 b=9700 b=9800 b=9900 b=10000 > rawp<-res1$rawp[order(res1$index)] > teststat<-res1$teststat[order(res1$index)] > > # Permutation adjusted p-values for simple multiple testing procedures > procs<-c("Bonferroni","Holm","Hochberg","SidakSS","SidakSD","BH","BY") > res2<-mt.rawp2adjp(rawp,procs) > > # Plot results from all multiple testing procedures > allp<-cbind(res2$adjp[order(res2$index),],res1$adjp[order(res1$index)]) > dimnames(allp)[[2]][9]<-"maxT" > procs<-dimnames(allp)[[2]] > procs[7:9]<-c("maxT","BH","BY") > allp<-allp[,procs] > > cols<-c(1:4,"orange","brown","purple",5:6) > ltypes<-c(3,rep(1,6),rep(2,2)) > > # Ordered adjusted p-values > mt.plot(allp,teststat,plottype="pvsr",proc=procs,leg=c(80,0.4),lty=ltypes,col=cols,lwd=2) > > # Adjusted p-values in original data order > mt.plot(allp,teststat,plottype="pvsi",proc=procs,leg=c(80,0.4),lty=ltypes,col=cols,lwd=2) > > # Number of rejected hypotheses vs. level of the test > mt.plot(allp,teststat,plottype="rvsa",proc=procs,leg=c(0.05,100),lty=ltypes,col=cols,lwd=2) > > # Adjusted p-values vs. test statistics > mt.plot(allp,teststat,plottype="pvst",logscale=TRUE,proc=procs,leg=c(0,4),pch=ltypes,col=cols) > > > > > cleanEx(); ..nameEx <- "mt.rawp2adjp" > > ### * mt.rawp2adjp > > flush(stderr()); flush(stdout()) > > ### Name: mt.rawp2adjp > ### Title: Adjusted p-values for simple multiple testing procedures > ### Aliases: mt.rawp2adjp > ### Keywords: htest > > ### ** Examples > > # Gene expression data from Golub et al. (1999) > # To reduce computation time and for illustrative purposes, we condider only > # the first 100 genes and use the default of B=10,000 permutations. > # In general, one would need a much larger number of permutations > # for microarray data. > > data(golub) > smallgd<-golub[1:100,] > classlabel<-golub.cl > > # Permutation unadjusted p-values and adjusted p-values for maxT procedure > res1<-mt.maxT(smallgd,classlabel) b=100 b=200 b=300 b=400 b=500 b=600 b=700 b=800 b=900 b=1000 b=1100 b=1200 b=1300 b=1400 b=1500 b=1600 b=1700 b=1800 b=1900 b=2000 b=2100 b=2200 b=2300 b=2400 b=2500 b=2600 b=2700 b=2800 b=2900 b=3000 b=3100 b=3200 b=3300 b=3400 b=3500 b=3600 b=3700 b=3800 b=3900 b=4000 b=4100 b=4200 b=4300 b=4400 b=4500 b=4600 b=4700 b=4800 b=4900 b=5000 b=5100 b=5200 b=5300 b=5400 b=5500 b=5600 b=5700 b=5800 b=5900 b=6000 b=6100 b=6200 b=6300 b=6400 b=6500 b=6600 b=6700 b=6800 b=6900 b=7000 b=7100 b=7200 b=7300 b=7400 b=7500 b=7600 b=7700 b=7800 b=7900 b=8000 b=8100 b=8200 b=8300 b=8400 b=8500 b=8600 b=8700 b=8800 b=8900 b=9000 b=9100 b=9200 b=9300 b=9400 b=9500 b=9600 b=9700 b=9800 b=9900 b=10000 > rawp<-res1$rawp[order(res1$index)] > > # Permutation adjusted p-values for simple multiple testing procedures > procs<-c("Bonferroni","Holm","Hochberg","SidakSS","SidakSD","BH","BY") > res2<-mt.rawp2adjp(rawp,procs) > > > > > cleanEx(); ..nameEx <- "mt.reject" > > ### * mt.reject > > flush(stderr()); flush(stdout()) > > ### Name: mt.reject > ### Title: Identity and number of rejected hypotheses > ### Aliases: mt.reject > ### Keywords: htest > > ### ** Examples > > # Gene expression data from Golub et al. (1999) > # To reduce computation time and for illustrative purposes, we condider only > # the first 100 genes and use the default of B=10,000 permutations. > # In general, one would need a much larger number of permutations > # for microarray data. > > data(golub) > smallgd<-golub[1:100,] > classlabel<-golub.cl > > # Permutation unadjusted p-values and adjusted p-values for maxT procedure > res<-mt.maxT(smallgd,classlabel) b=100 b=200 b=300 b=400 b=500 b=600 b=700 b=800 b=900 b=1000 b=1100 b=1200 b=1300 b=1400 b=1500 b=1600 b=1700 b=1800 b=1900 b=2000 b=2100 b=2200 b=2300 b=2400 b=2500 b=2600 b=2700 b=2800 b=2900 b=3000 b=3100 b=3200 b=3300 b=3400 b=3500 b=3600 b=3700 b=3800 b=3900 b=4000 b=4100 b=4200 b=4300 b=4400 b=4500 b=4600 b=4700 b=4800 b=4900 b=5000 b=5100 b=5200 b=5300 b=5400 b=5500 b=5600 b=5700 b=5800 b=5900 b=6000 b=6100 b=6200 b=6300 b=6400 b=6500 b=6600 b=6700 b=6800 b=6900 b=7000 b=7100 b=7200 b=7300 b=7400 b=7500 b=7600 b=7700 b=7800 b=7900 b=8000 b=8100 b=8200 b=8300 b=8400 b=8500 b=8600 b=8700 b=8800 b=8900 b=9000 b=9100 b=9200 b=9300 b=9400 b=9500 b=9600 b=9700 b=9800 b=9900 b=10000 > mt.reject(cbind(res$rawp,res$adjp),seq(0,1,0.1))$r [,1] [,2] 0 0 0 0.1 35 8 0.2 45 11 0.3 57 14 0.4 64 14 0.5 70 16 0.6 77 19 0.7 81 22 0.8 88 24 0.9 91 27 1 100 100 > > > > > cleanEx(); ..nameEx <- "mt.sample.teststat" > > ### * mt.sample.teststat > > flush(stderr()); flush(stdout()) > > ### Name: mt.sample.teststat > ### Title: Permutation distribution of test statistics and raw (unadjusted) > ### p-values > ### Aliases: mt.sample.teststat mt.sample.rawp mt.sample.label > ### Keywords: manip > > ### ** Examples > > > # Gene expression data from Golub et al. (1999) > data(golub) > > mt.sample.label(golub.cl,B=10) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] 0 0 0 0 0 0 0 0 0 0 0 0 0 [2,] 1 0 0 0 1 0 0 0 1 0 0 0 0 [3,] 0 0 1 0 0 0 1 1 0 0 0 0 0 [4,] 0 0 0 0 0 0 0 0 0 0 0 0 0 [5,] 1 0 0 0 0 0 1 0 1 0 0 0 0 [6,] 1 0 0 0 0 0 1 1 1 1 0 0 1 [7,] 0 0 0 0 0 0 0 1 1 0 1 0 0 [8,] 0 0 0 0 0 0 0 1 0 0 0 0 1 [9,] 1 0 1 0 1 0 0 0 0 0 0 1 1 [10,] 1 1 0 0 0 1 0 0 1 1 0 0 1 [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [1,] 0 0 0 0 0 0 0 0 0 0 0 0 [2,] 0 0 0 1 0 1 0 0 0 1 0 1 [3,] 1 0 0 0 0 1 0 1 0 0 0 0 [4,] 1 1 1 1 0 0 1 1 0 0 0 1 [5,] 1 0 0 0 0 0 0 0 1 0 1 0 [6,] 0 0 0 1 1 0 0 0 0 0 0 0 [7,] 1 1 0 0 1 1 0 0 0 0 1 0 [8,] 1 1 0 1 1 1 1 0 0 1 0 0 [9,] 1 0 0 0 0 1 0 0 0 0 0 1 [10,] 0 0 1 0 0 1 0 0 0 0 0 0 [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [1,] 0 0 1 1 1 1 1 1 1 1 1 1 [2,] 0 0 0 0 1 0 0 0 0 0 1 1 [3,] 1 0 1 0 1 1 0 0 0 0 0 1 [4,] 0 0 0 1 1 0 0 0 1 1 0 0 [5,] 1 0 0 0 1 0 0 1 1 1 0 0 [6,] 0 1 0 1 0 1 0 0 0 0 0 0 [7,] 1 0 0 0 0 1 0 0 0 0 0 0 [8,] 1 0 0 0 0 0 0 0 0 0 0 1 [9,] 1 0 0 0 0 1 0 0 0 1 0 0 [10,] 0 1 0 0 0 1 0 0 0 0 1 0 [,38] [1,] 1 [2,] 1 [3,] 0 [4,] 0 [5,] 0 [6,] 0 [7,] 1 [8,] 0 [9,] 0 [10,] 0 > > permt<-mt.sample.teststat(golub[1,],golub.cl,B=1000) > qqnorm(permt) > qqline(permt) > > permt<-mt.sample.teststat(golub[50,],golub.cl,B=1000) > qqnorm(permt) > qqline(permt) > > permp<-mt.sample.rawp(golub[1,],golub.cl,B=1000) > hist(permp) > > > > cleanEx(); ..nameEx <- "mt.teststat" > > ### * mt.teststat > > flush(stderr()); flush(stdout()) > > ### Name: mt.teststat > ### Title: Computing test statistics for each row of a data frame > ### Aliases: mt.teststat mt.teststat.num.denum > ### Keywords: univar > > ### ** Examples > > # Gene expression data from Golub et al. (1999) > data(golub) > > teststat<-mt.teststat(golub,golub.cl) > qqnorm(teststat) > qqline(teststat) > > tmp<-mt.teststat.num.denum(golub,golub.cl,test="t") > num<-tmp$teststat.num > denum<-tmp$teststat.denum > plot(sqrt(denum),num) > > tmp<-mt.teststat.num.denum(golub,golub.cl,test="f") > > > > > cleanEx(); ..nameEx <- "ss.maxT" > > ### * ss.maxT > > flush(stderr()); flush(stdout()) > > ### Name: ss.maxT > ### Title: Procedures to perform multiple testing > ### Aliases: ss.maxT ss.minP sd.maxT sd.minP > ### Keywords: htest internal > > ### ** Examples > > ## These functions are used internally by the MTP function > ## See MTP function: ? MTP > > > > cleanEx(); ..nameEx <- "wapply" > > ### * wapply > > flush(stderr()); flush(stdout()) > > ### Name: wapply > ### Title: Weighted version of the apply function > ### Aliases: wapply > ### Keywords: internal > > ### ** Examples > > data<-matrix(rnorm(200),nr=20) > weights<-matrix(rexp(200,rate=0.1),nr=20) > wapply(X=data,MARGIN=1,FUN=mean,W=weights) [1] -0.53731310 0.11287960 0.14724489 -0.07577719 -0.35971689 0.06633178 [7] 0.42600551 -0.01011928 -0.12837291 0.23731857 0.42414649 -0.06067378 [13] 0.42233521 -0.79002925 -0.27069079 -0.21887077 -0.31048450 -0.40369660 [19] 0.45308152 -0.09597569 > > > > ### *