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("permax-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('permax') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "permax" > > ### * permax > > flush(stderr()); flush(stdout()) > > ### Name: permax > ### Title: 2-sample permutation t-tests for high dimensional data > ### Aliases: permax > ### Keywords: htest > > ### ** Examples > > #generate make believe data > set.seed(1292) > ngenes <- 1000 > m1 <- rnorm(ngenes,4,1) > m2 <- rnorm(ngenes,4,1) > exp1 <- cbind(matrix(exp(rnorm(ngenes*5,m1,1)),nrow=ngenes), + matrix(exp(rnorm(ngenes*10,m2,1)),nrow=ngenes)) > exp1[exp1<20] <- 20 > sub <- exp1>20 & exp1<150 > exp1[sub] <- ifelse(runif(length(sub[sub]))<.5,20,exp1[sub]) > dimnames(exp1) <- list(paste('x',format(1:ngenes,justify='l'),sep=''), + paste('sample',format(1:ncol(exp1),justify='l'),sep='')) > dimnames(exp1) <- list(paste('x',1:ngenes,sep=''), + paste('sample',1:ncol(exp1),sep='')) > exp1 <- round(exp1) > > uu <- permax(exp1,1:5) statistics will be computed for all 3003 groupings > summary(uu,nl=5,nr=5) # 5 most extreme in each direction stat p.lower m1 m2 s1 s2 np1 np2 mdiff mrat x105 -13.928 0.000333 3.102 6.671 0.2373 0.5395 1 10 -766.6 0.028193 x455 -11.646 0.000333 3.191 7.696 0.4358 0.7976 1 10 -2175.2 0.011050 x585 -10.648 0.000666 2.996 8.396 0.0000 1.1129 0 10 -4410.2 0.004515 x104 -10.629 0.000666 2.996 5.462 0.0000 0.5091 0 10 -215.5 0.084909 x734 -8.328 0.003663 3.228 6.616 0.5202 0.8225 1 10 -721.9 0.033779 stat p.upper m1 m2 s1 s2 np1 np2 mdiff mrat x225 19.17 0.001332 5.131 3.046 0.3017 0.12841 5 2 148.1 8.042 x460 17.28 0.001998 6.467 3.075 0.5267 0.24933 5 1 621.6 29.725 x25 14.37 0.002331 6.210 3.014 0.7269 0.05766 5 1 477.3 24.432 x668 13.54 0.003330 6.493 3.049 0.7984 0.16780 5 1 639.3 31.315 x217 12.88 0.004329 5.956 3.092 0.6395 0.23738 5 2 363.9 17.523 > > > > cleanEx(); ..nameEx <- "permcor" > > ### * permcor > > flush(stderr()); flush(stdout()) > > ### Name: permcor > ### Title: permutation tests for correlations in high dimensional data > ### Aliases: permcor > ### Keywords: htest > > ### ** Examples > > set.seed(1292) > ngenes <- 1000 > m1 <- rnorm(ngenes,4,1) > m2 <- rnorm(ngenes,4,1) > exp1 <- cbind(matrix(exp(rnorm(ngenes*5,m1,1)),nrow=ngenes), + matrix(exp(rnorm(ngenes*10,m2,1)),nrow=ngenes)) > exp1[exp1<20] <- 20 > sub <- exp1>20 & exp1<150 > exp1[sub] <- ifelse(runif(length(sub[sub]))<.5,20,exp1[sub]) > dimnames(exp1) <- list(paste('x',format(1:ngenes,justify='l'),sep=''), + paste('sample',format(1:ncol(exp1),justify='l'),sep='')) > dimnames(exp1) <- list(paste('x',1:ngenes,sep=''), + paste('sample',1:ncol(exp1),sep='')) > exp1 <- round(exp1) > > #see the permax help file for the definition of exp1 > u8 <- permcor(exp1,1:15) > summary(u8,nr=4,nl=4) stat p.lower np x246 -0.8792 0.009 9 x487 -0.8461 0.023 9 x54 -0.8256 0.046 7 x362 -0.8109 0.071 6 stat p.upper np x930 0.8560 0.017 9 x275 0.8317 0.037 9 x683 0.8300 0.040 10 x104 0.8148 0.073 10 > u10 <- permcor(exp1[,c(1:3,5:8)],c(1,1,1,0,0,0,0),nperm=0) statistics will be computed for all 5040 permutationss > > summary(u10,nl=4,nr=4) stat p.lower np x774 -0.9960 0.05714 4 x498 -0.9686 0.31429 4 x421 -0.9230 0.77143 4 x773 -0.9227 0.77143 5 stat p.upper np x247 0.9995 0.02857 3 x110 0.9990 0.05714 3 x165 0.9909 0.37143 4 x101 0.9853 0.45714 3 > > > > > cleanEx(); ..nameEx <- "permsep" > > ### * permsep > > flush(stderr()); flush(stdout()) > > ### Name: permsep > ### Title: Permutation analysis for complete separation > ### Aliases: permsep > ### Keywords: htest > > ### ** Examples > > ngenes <- 1000 > m1 <- rnorm(ngenes,4,1) > m2 <- rnorm(ngenes,4,1) > exp1 <- cbind(matrix(exp(rnorm(ngenes*5,m1,1)),nrow=ngenes), + matrix(exp(rnorm(ngenes*10,m2,1)),nrow=ngenes)) > exp1[exp1<20] <- 20 > sub <- exp1>20 & exp1<150 > exp1[sub] <- ifelse(runif(length(sub[sub]))<.5,20,exp1[sub]) > dimnames(exp1) <- list(paste('x',format(1:ngenes,justify='l'),sep=''), + paste('sample',format(1:ncol(exp1),justify='l'),sep='')) > dimnames(exp1) <- list(paste('x',1:ngenes,sep=''), + paste('sample',1:ncol(exp1),sep='')) > exp1 <- round(exp1) > > uuu <- permsep(exp1,1:5) statistics will be computed for all 3003 groupings # comp sep; prop perm with more; ave # per perm; prop perm with any [1] 4.100000e+01 3.330003e-04 3.523144e-01 2.564103e-01 > > > > > cleanEx(); ..nameEx <- "plot.expr" > > ### * plot.expr > > flush(stderr()); flush(stdout()) > > ### Name: plot.expr > ### Title: Color image plot of gene expression levels > ### Aliases: plot.expr > ### Keywords: hplot > > ### ** Examples > > set.seed(1292) > ngenes <- 1000 > m1 <- rnorm(ngenes,4,1) > m2 <- rnorm(ngenes,4,1) > exp1 <- cbind(matrix(exp(rnorm(ngenes*5,m1,1)),nrow=ngenes), + matrix(exp(rnorm(ngenes*10,m2,1)),nrow=ngenes)) > exp1[exp1<20] <- 20 > sub <- exp1>20 & exp1<150 > exp1[sub] <- ifelse(runif(length(sub[sub]))<.5,20,exp1[sub]) > dimnames(exp1) <- list(paste('x',format(1:ngenes,justify='l'),sep=''), + paste('sample',format(1:ncol(exp1),justify='l'),sep='')) > dimnames(exp1) <- list(paste('x',1:ngenes,sep=''), + paste('sample',1:ncol(exp1),sep='')) > exp1 <- round(exp1) > > plot.expr(exp1[1:20,]) > > > > cleanEx(); ..nameEx <- "plot.permax" > > ### * plot.permax > > flush(stderr()); flush(stdout()) > > ### Name: plot.permax > ### Title: Image plot of the most significant genes (attributes) from a > ### permax analysis > ### Aliases: plot.permax > ### Keywords: hplot > > ### ** Examples > > set.seed(1292) > ngenes <- 1000 > m1 <- rnorm(ngenes,4,1) > m2 <- rnorm(ngenes,4,1) > exp1 <- cbind(matrix(exp(rnorm(ngenes*5,m1,1)),nrow=ngenes), + matrix(exp(rnorm(ngenes*10,m2,1)),nrow=ngenes)) > exp1[exp1<20] <- 20 > sub <- exp1>20 & exp1<150 > exp1[sub] <- ifelse(runif(length(sub[sub]))<.5,20,exp1[sub]) > dimnames(exp1) <- list(paste('x',format(1:ngenes,justify='l'),sep=''), + paste('sample',format(1:ncol(exp1),justify='l'),sep='')) > dimnames(exp1) <- list(paste('x',1:ngenes,sep=''), + paste('sample',1:ncol(exp1),sep='')) > exp1 <- round(exp1) > > uu <- permax(exp1,1:5) statistics will be computed for all 3003 groupings > plot(uu,exp1,ig1=1:5,cex=.7) > > > > cleanEx(); ..nameEx <- "rowperm" > > ### * rowperm > > flush(stderr()); flush(stdout()) > > ### Name: rowperm > ### Title: Generates random permutations within rows of a matrix > ### Aliases: rowperm > ### Keywords: utilities > > ### ** Examples > > x <- matrix(1:12,3) > x [,1] [,2] [,3] [,4] [1,] 1 4 7 10 [2,] 2 5 8 11 [3,] 3 6 9 12 > # [,1] [,2] [,3] [,4] > #[1,] 1 4 7 10 > #[2,] 2 5 8 11 > #[3,] 3 6 9 12 > rowperm(x) [,1] [,2] [,3] [,4] [1,] 4 7 10 1 [2,] 11 5 2 8 [3,] 12 9 3 6 > # [,1] [,2] [,3] [,4] > #[1,] 10 7 1 4 > #[2,] 8 11 2 5 > #[3,] 6 12 9 3 > > > > > cleanEx(); ..nameEx <- "summary.permax" > > ### * summary.permax > > flush(stderr()); flush(stdout()) > > ### Name: summary.permax > ### Title: Summarizes the output of permax > ### Aliases: summary.permax print.summary.permax > ### Keywords: print > > ### ** Examples > > # An example is given in the permax help file > > > > ### *