resampMed: Resampling test on the median (only returns the p-value)

Description Usage Arguments Value DETAILS Author(s) See Also Examples

View source: R/distTests.R

Description

Resampling test on the median (only returns the p-value)

Usage

1
resampMed(.x, .y, R = 10000)

Arguments

.x

A data frame with distances for the gene set of interest.

.y

A data frame with distances for the control/reference gene set.

R

Number of samples to draw from .y

Value

A p-value representing the percentage of times that the median of R random samples drawn from the union of .x and .y is below the observed median of .x.

DETAILS

Both .x and .y should contain at least the following columns:

Author(s)

Pascal GP Martin

See Also

replicate colMedians

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Create some random distance data
  set.seed(123)
  mydistData <- data.frame(GeneName = stringi::stri_rand_strings(400, 5),
                           Distance = sample(1:5000, 400, replace=TRUE),
                           GeneSet = sample(c("TestSet", "RefSet"),
                                            400, replace= TRUE))
## Evaluate (by resampling) the probability to get a median lower that that of TestSet
## We use only 1000 random samples here for speed purposes but you should use >1e4
  resampMed(.x = mydistData[mydistData$GeneSet == "TestSet",],
            .y = mydistData[mydistData$GeneSet == "RefSet",],
            R = 1e3)
## If .x is empty, the function returns NA
  resampMed(.x = mydistData[mydistData$GeneSet == "SomeRandomName",],
            .y = mydistData[mydistData$GeneSet == "RefSet",],
            R = 1e3)
## If .y is empty, the function returns an error
## Not run: 
  resampMed(.x = mydistData[mydistData$GeneSet == "TestSet",],
            .y = mydistData[mydistData$GeneSet == "SomeRandomName",],
            R = 1e3)
        
## End(Not run)

pgpmartin/GeneNeighborhood documentation built on Sept. 2, 2021, 6:37 a.m.