R.test: Rank Test Based on the Modified Band Depth

Description Usage Arguments Details Value Author(s) References Examples

View source: R/R.test.R

Description

R.test performs the rank test based on the modified band depth, to decide whether two samples come from a single parent distribution.

Usage

1
R.test(x,y,n,m,seed=0)

Arguments

x

a data matrix containing the observations (samples) by rows and the variables (genes) by columns from the first population

y

a data matrix containing the observations (samples) by rows and the variables (genes) by columns from the second population

n

size of the first sample (less or equal than the number of rows in x)

m

size of the second sample (less or equal than the number of rows in y)

seed

seed to inizialize the random number generation. 0 by default

Details

Given a population P from which a sample of n vectors is drawn, and another population P' from which a second sample of m vectors is obtained, assume there is a third reference sample (from the same population as the largest sample), whose size is also larger than n and m. R.test identifies the largest sample as the one to be split into test and reference samples and verifies if there are enough observations to run the test. Then, the rank test calculates the proportions R and R' of elements from the reference sample whose depths are less or equal than those from the other samples, relative to the reference one, respectively, and order these values from smallest to highest, giving them a rank from 1 to n+m. The statistic sum of the ranks of values R' (from the second population) has the distribution of a sum of m elements randomly drawn from 1 to n+m without replacement.

Value

a list containing:

p.value

the p-value of the rank test

statistic

the value of the statistic W of the rank test

Author(s)

Sara Lopez-Pintado sl2929@columbia.edu and

Aurora Torrente etorrent@est-econ.uc3m.es

References

Lopez-Pintado, S. et al. (2010). Robust depth-based tools for the analysis of gene expression data. Biostatistics, 11 (2), 254-264.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Rank test for samples from the same population
  x <- matrix(rnorm(100),10,10)
  R.test(x,x,4,4)$p.value

  ## real data
  data(prostate)
  prost.x<-prostate[,1:100]
  prost.y<-prostate[,101]
  normal<-prost.x[prost.y==0,]
  R.test(normal,normal,10,10)$p.value


##  Rank test for samples from different populations
  x <- matrix(rnorm(100),10,10)
  y <- matrix(rnorm(100,5),10,10)
  R.test(x,y,4,4)$p.value

  ## real data
  tumor<-prost.x[prost.y==1,]
  R.test(normal,tumor,10,10)$p.value

depthTools documentation built on May 24, 2021, 9:06 a.m.