shiftR (version 1.4)

getOffsets: Generate Random or Uniformly Spaced Permutation Offsets

Description

This functions generate offsets for permutation analysis with shiftrPermBinary. Random, uniformly spaced, and complete sets are available via getOffsetsRandom, getOffsetsUniform, and getOffsetsAll functions respectively.

The function getNOffestsMax calculates the maximum number of permutations (given the margin).

Usage

getOffsetsRandom(n, npermute, margin = 0.05)
getOffsetsUniform(n, npermute, margin = 0.05)
getOffsetsAll(n, margin)

getNOffsetsMax(n, margin)

Arguments

n

Number of features in the permuted sets.

npermute

The number of offsets to be generated (number of permutations).

margin

Offsets by less than margin*n or more than (1-margin)*n are not generated.

Value

Returns a set of permutation offsets for use in shiftrPermBinary function. The set of offsets is

  1. random for getOffsetsRandom,

  2. uniformly spaced for getOffsetsUniform, or

  3. all possible for getOffsetsAll.

The function getNOffestsMax returns the maximum number of permutations (given the margin).

Examples

Run this code
# NOT RUN {
### Number of features, permutations, and margin
n = 100
npermute = 20
margin = 0.1

### Maximum number of permutations 
# Should be 81 (from 10 to 90)
getNOffsetsMax(n, margin)

### Random offsets
getOffsetsRandom(n, npermute, margin)

### Uniformly spaced offsets
getOffsetsUniform(n, npermute, margin)

### All possible offsets
getOffsetsAll(n, margin)
# }

Run the code above in your browser using DataCamp Workspace