Skip to contents

Mini batch version of a rowTestFUN function.

Usage

mini_batch_rowTestFUN(
  rowTestFUN,
  Y,
  categ,
  alternative = c("two.sided", "less", "greater"),
  max_batch_size = 1e+06
)

Arguments

rowTestFUN

A function taking as inputs Y, categ and Alternative and giving as a result a matrix of $p$-values. Example rowWelchTests or rowWilcoxonTests.

Y

A \(m \times n\) numeric matrix whose rows correspond to variables and columns to observations

categ

Either a numeric vector of n categories in \(0, 1\) for the observations, or a n x B matrix stacking B such vectors (typically permutations of an original vector of size n)

alternative

A character string specifying the alternative hypothesis. Must be one of "two.sided" (default), "greater" or "less". As in t.test, alternative = "greater" is the alternative that class 1 has a larger mean than class 0.

max_batch_size

A number specifying the maximum size of information in each batch

Value

the p-values for the test

Examples

p <- 53 
n <- 35
mat <- matrix(rnorm(p * n), ncol = n)
cls <- rep(c(0, 1), times = c(10, n - 10))
mini_batch_rowTestFUN(rowTestFUN = rowWelchTests, Y = mat, 
                      categ = cls, alternative = "two.sided", 
                      max_batch_size = 1e6)
#>              [,1]
#>  [1,] 0.867235393
#>  [2,] 0.382276448
#>  [3,] 0.493567831
#>  [4,] 0.841240510
#>  [5,] 0.197891169
#>  [6,] 0.218521970
#>  [7,] 0.521973338
#>  [8,] 0.196757560
#>  [9,] 0.316249739
#> [10,] 0.374962781
#> [11,] 0.554294292
#> [12,] 0.825626715
#> [13,] 0.990996847
#> [14,] 0.177209337
#> [15,] 0.034669167
#> [16,] 0.710595285
#> [17,] 0.643490084
#> [18,] 0.139777131
#> [19,] 0.571719442
#> [20,] 0.699593915
#> [21,] 0.289218653
#> [22,] 0.302360245
#> [23,] 0.471609644
#> [24,] 0.669316392
#> [25,] 0.626181231
#> [26,] 0.251457961
#> [27,] 0.854710842
#> [28,] 0.006716452
#> [29,] 0.270750882
#> [30,] 0.873258157
#> [31,] 0.237866473
#> [32,] 0.246847782
#> [33,] 0.114524124
#> [34,] 0.312272548
#> [35,] 0.596637226
#> [36,] 0.071628662
#> [37,] 0.568003717
#> [38,] 0.171557138
#> [39,] 0.475186850
#> [40,] 0.546415781
#> [41,] 0.273977820
#> [42,] 0.328299609
#> [43,] 0.258423649
#> [44,] 0.031190045
#> [45,] 0.605094168
#> [46,] 0.538813157
#> [47,] 0.337318705
#> [48,] 0.880733271
#> [49,] 0.085277025
#> [50,] 0.305441810
#> [51,] 0.245825409
#> [52,] 0.606897966
#> [53,] 0.430011018