DA.per | R Documentation |
Test significance of multiple features with a binary predictor
with a permutation scheme.
DA.per( data, predictor, paired = NULL, relative = TRUE, p.adj = "fdr", testStat = function(case, control) { log2((mean(case) + 1)/(mean(control) + 1)) }, testStat.pair = function(case, control) { log2(mean((case + 1)/(control + 1))) }, noOfIterations = 10000, margin = 50 )
data |
Either a matrix with counts/abundances, OR a |
predictor |
The predictor of interest. Factor, OR if |
paired |
For paired/blocked experimental designs. Either a Factor with Subject/Block ID for running paired/blocked analysis, OR if |
relative |
Logical. Should |
p.adj |
Character. P-value adjustment. Default "fdr". See |
testStat |
Function. Function for the test statistic. Should take two vectors as arguments. Default is a log fold change: |
testStat.pair |
Function. Function for test statistic for paired analysis. Should take two vectors as arguments. Default is a log fold change: |
noOfIterations |
Integer. Iterations for permutations. Default 10000 |
margin |
Numeric. Margin for when to stop iterations if p-value is high and unlikely to become low |
Modified version of the one from: https://microbiomejournal.biomedcentral.com/articles/10.1186/s40168-016-0208-8. P-values are now two-sided, and test statistic is a simple log fold change
A paired permutation test is implemented specifically for this package. The test is similar to the original, but with a different test statistic and permutation scheme. The permutations are constrained in the paired version such that the predictor is only permuted within each level of the paired argument (e.g. subjects). The test statistic first finds the log-ratio between the two predictor levels (e.g. case and control) for each level of the paired argument and the final statistic is the mean of these log-ratios.
A data.frame with with results.
# Creating random count_table and predictor set.seed(4) mat <- matrix(rnbinom(1000, size = 0.1, mu = 500), nrow = 100, ncol = 10) rownames(mat) <- 1:100 pred <- c(rep("Control", 5), rep("Treatment", 5)) # Running permutation test on each feature res <- DA.per(data = mat, predictor = pred)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.