Given a pattern, it splits and returns the slot of interest.

edge.pvalue(stat, stat0, pool = TRUE)

Arguments

stat

vector of observed statistics.

stat0

matrix of null statistics, where rows are features and columns are iterations.

pool

features are interchangeable, e.g. unlist all null statistics.

Value

A vector of empirical p-values.

Author

Jeffrey T Leek, Leonardo Collado-Torres (examples)

Examples


## Vector of statistics
z <- rnorm(100, mean = 2)

## Matrix with one row per element in the vector of statistics
## and one column per permutation (here 100)
z0 <- matrix(rnorm(1e5), nrow = 100)

## Pool all the permutations (default)
edge.pvalue(z, z0, pool = TRUE)
#>   [1] 0.01382 0.03510 0.01428 0.03591 0.03543 0.29914 0.00372 0.06909 0.01696
#>  [10] 0.10202 0.01038 0.13017 0.00072 0.05472 0.00008 0.18784 0.00155 0.00004
#>  [19] 0.00034 0.09499 0.07930 0.21570 0.16363 0.18444 0.00146 0.34111 0.00524
#>  [28] 0.01969 0.15938 0.00399 0.27992 0.01487 0.00001 0.00360 0.19069 0.00056
#>  [37] 0.00966 0.00005 0.02098 0.01167 0.00100 0.21018 0.02098 0.10707 0.00453
#>  [46] 0.06180 0.17439 0.00008 0.00204 0.04405 0.00005 0.00085 0.02831 0.00347
#>  [55] 0.05188 0.13136 0.00249 0.55647 0.22300 0.06620 0.00063 0.00387 0.07530
#>  [64] 0.00216 0.14057 0.00604 0.31523 0.26866 0.03212 0.00103 0.07873 0.10390
#>  [73] 0.00021 0.06156 0.26509 0.10712 0.39060 0.25550 0.00390 0.00145 0.00001
#>  [82] 0.19433 0.00430 0.17409 0.00003 0.00334 0.12231 0.00089 0.00008 0.01361
#>  [91] 0.07739 0.08164 0.02312 0.00048 0.01593 0.03107 0.16248 0.08148 0.00293
#> [100] 0.14941

## Or don't pull them
edge.pvalue(z, z0, pool = FALSE)
#>   [1] 0.018 0.027 0.017 0.040 0.032 0.307 0.002 0.069 0.020 0.107 0.004 0.115
#>  [13] 0.001 0.067 0.001 0.186 0.001 0.001 0.001 0.095 0.091 0.223 0.153 0.194
#>  [25] 0.001 0.362 0.001 0.016 0.183 0.004 0.302 0.015 0.001 0.006 0.172 0.001
#>  [37] 0.007 0.001 0.021 0.015 0.001 0.202 0.031 0.103 0.001 0.057 0.178 0.001
#>  [49] 0.001 0.044 0.001 0.001 0.021 0.003 0.055 0.111 0.002 0.567 0.229 0.064
#>  [61] 0.001 0.004 0.071 0.002 0.160 0.008 0.318 0.268 0.034 0.001 0.060 0.097
#>  [73] 0.001 0.061 0.273 0.104 0.400 0.255 0.009 0.001 0.001 0.195 0.004 0.176
#>  [85] 0.001 0.003 0.115 0.001 0.001 0.007 0.077 0.082 0.023 0.001 0.016 0.031
#>  [97] 0.180 0.075 0.004 0.139