randomize
permutates independently the entries in
each column of a matrix-like object, to produce random
data that can be used in permutation tests or bootstrap
analysis.
randomize(x, ...)
apply
.sample
.a matrix
In the context of NMF, it may be used to generate random data, whose factorization serves as a reference for selecting a factorization rank, that does not overfit the data.
x <- matrix(1:32, 4, 8)
randomize(x)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## [1,] 3 8 11 14 19 22 25 30
## [2,] 4 7 9 13 18 21 27 31
## [3,] 2 5 10 16 20 24 26 32
## [4,] 1 6 12 15 17 23 28 29
randomize(x)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## [1,] 3 8 9 14 17 24 28 32
## [2,] 1 5 12 13 19 22 27 30
## [3,] 2 6 11 16 20 23 26 31
## [4,] 4 7 10 15 18 21 25 29