Generates a block permutation p-value. Uses a heuristic to decide whether to use distance caching or simple block permutations.

blockPermute(
  X,
  block_boundaries = NULL,
  block_labels = NULL,
  nruns,
  type,
  p = 2
)

Arguments

X

The binary or real matrix on which to perform permutation resampling

block_boundaries

Vector denoting the positions where a new block of non-independent features starts. Default is NULL.

block_labels

Length \(P\) vector recording the block label of each feature. Default is NULL.

nruns

The resampling number (use at least 1000)

type

Either an unbiased estimate (`'unbiased'`, default), or exact (`'valid'`) p-value (see Hemerik and Goeman, 2018), or both (`'both'`). Default is `'unbiased'`.

p

The power p of \(l_p^p\), i.e., \(||x||_p^p = (x_1^p+...x_n^p)\)

Value

The block permutation p-value

Details

Dependencies: buildForward, buildReverse, cachePermute, cacheBlockPermute1, cacheBlockPermute2, getHammingDistance, getLpDistance, naiveBlockPermute1, naiveBlockPermute2