Last data update: 2014.03.03

R: Permutation distribution of test statistics and raw...
mt.sample.teststatR Documentation

Permutation distribution of test statistics and raw (unadjusted) p-values

Description

These functions provide tools to investigate the permutation distribution of test statistics, raw (unadjusted) p-values, and class labels.

Usage

mt.sample.teststat(V,classlabel,test="t",fixed.seed.sampling="y",B=10000,na=.mt.naNUM,nonpara="n")
mt.sample.rawp(V,classlabel,test="t",side="abs",fixed.seed.sampling="y",B=10000,na=.mt.naNUM,nonpara="n")
mt.sample.label(classlabel,test="t",fixed.seed.sampling="y",B=10000)

Arguments

V

A numeric vector containing the data for one of the variables (genes).

classlabel

A vector of integers corresponding to observation (column) class labels. For k classes, the labels must be integers between 0 and k-1. For the blockf test option, observations may be divided into n/k blocks of k observations each. The observations are ordered by block, and within each block, they are labeled using the integers 0 to k-1.

test

A character string specifying the statistic to be used to test the null hypothesis of no association between the variables and the class labels.
If test="t", the tests are based on two-sample Welch t-statistics (unequal variances).
If test="t.equalvar", the tests are based on two-sample t-statistics with equal variance for the two samples. The square of the t-statistic is equal to an F-statistic for k=2.
If test="wilcoxon", the tests are based on standardized rank sum Wilcoxon statistics.
If test="f", the tests are based on F-statistics.
If test="pairt", the tests are based on paired t-statistics. The square of the paired t-statistic is equal to a block F-statistic for k=2.
If test="blockf", the tests are based on F-statistics which adjust for block differences (cf. two-way analysis of variance).

side

A character string specifying the type of rejection region.
If side="abs", two-tailed tests, the null hypothesis is rejected for large absolute values of the test statistic.
If side="upper", one-tailed tests, the null hypothesis is rejected for large values of the test statistic.
If side="lower", one-tailed tests, the null hypothesis is rejected for small values of the test statistic.

fixed.seed.sampling

If fixed.seed.sampling="y", a fixed seed sampling procedure is used, which may double the computing time, but will not use extra memory to store the permutations. If fixed.seed.sampling="n", permutations will be stored in memory. For the blockf test, the option n was not implemented as it requires too much memory.

B

The number of permutations. For a complete enumeration, B should be 0 (zero) or any number not less than the total number of permutations.

na

Code for missing values (the default is .mt.naNUM=--93074815.62). Entries with missing values will be ignored in the computation, i.e., test statistics will be based on a smaller sample size. This feature has not yet fully implemented.

nonpara

If nonpara="y", nonparametric test statistics are computed based on ranked data.
If nonpara="n", the original data are used.

Value

For mt.sample.teststat, a vector containing B permutation test statistics.

For mt.sample.rawp, a vector containing B permutation unadjusted p-values.

For mt.sample.label, a matrix containing B sets of permuted class labels. Each row corresponds to one permutation.

Author(s)

Yongchao Ge, yongchao.ge@mssm.edu,
Sandrine Dudoit, http://www.stat.berkeley.edu/~sandrine.

See Also

mt.maxT, mt.minP, golub.

Examples


# Gene expression data from Golub et al. (1999)
data(golub)

mt.sample.label(golub.cl,B=10)

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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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 an HTML browser interface to help.
Type 'q()' to quit R.

> library(multtest)
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/multtest/mt.sample.teststat.Rd_%03d_medium.png", width=480, height=480)
> ### 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)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>