Description Usage Arguments Value Author(s) See Also Examples

This function performs very fast feature enrichment
permutation testing between two binary data sets.
Circular permutations are used instead of simple permutations to
preserve local dependence of test statistics.
The input data sets can be preprocessed with
`shiftrPrepareLeft`

and `shiftrPrepareRight`

functions.

1 2 3 4 5 6 | ```
shiftrPermBinary(
left,
right,
offsets,
alsoDoFisher = TRUE,
returnPermOverlaps = FALSE)
``` |

`left` |
The first vector of binary (0/1) outcomes. |

`right` |
The second vector of binary (0/1) outcomes. |

`offsets` |
Vector of offsets, can be generated by |

`alsoDoFisher` |
If |

`returnPermOverlaps` |
If |

Returns a list with:

`nfeatures` |
Number of features in input data sets. |

`lfeatures` |
Number of active features in the left data set. |

`rfeatures` |
Number of active features in the right data set. |

`overlap` |
Number of features simultaneously active in both data sets. |

`overlapUnderNull` |
Expected value of |

`enrichment` |
Enrichment ratio, equal to |

`permPVenrich` |
Permutation p-value for enrichment (one-sided). |

`permPVdeplete` |
Permutation p-value for depletion (one-sided). |

`permPV` |
Permutation p-value for depletion (two-sided). |

`permZ` |
Permutation z-statistic,
calculated by fitting normal distribution to the |

`fisherTest` |
Fisher exact test, as output by |

`fisherMat` |
Input 2x2 matrix for Fisher exact test. |

`overlapsPerm` |
Vector of length |

Andrey A Shabalin andrey.shabalin@gmail.com

This function essentially involves `npermute`

calls of
`singlePermutation`

function
and calculation of summary statistics and p-values.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
### Number of features
nf = 1e6
npermute = 10000
### Generate data sets
# The vector of a few common active feature to create dependence
common = sample(c(0L,1L), size = nf, replace = TRUE, prob = c(0.999,0.001))
# Left and right data sets with the common active features
lset = sample(c(0L,1L), size = nf, replace = TRUE, prob = c(0.8,0.2)) | common
rset = sample(c(0L,1L), size = nf, replace = TRUE, prob = c(0.8,0.2)) | common
offsets = getOffsetsUniform(n = nf, npermute = npermute)
show(head(offsets))
show(tail(offsets))
z = shiftrPermBinary(lset, rset, offsets)
show(z)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.