| powerDA | R Documentation |
Estimating (empirical) statistical power for a specific differential abundance and expression method on a specific dataset
powerDA( data, predictor, paired = NULL, covars = NULL, test = NULL, effectSizes = c(2, 4, 8, 16, 32), alpha.p = 0.05, alpha.q = 0.1, p.adj = "fdr", R = 5, relative = TRUE, k = NULL, cores = (detectCores() - 1), args = list(), out.all = NULL, core.check = TRUE, verbose = TRUE )
data |
Either a data.frame with counts/abundances, OR a |
predictor |
The predictor of interest. Either a Factor or Numeric, OR if |
paired |
For paired/blocked experimental designs. Either a Factor with Subject/Block ID for running paired/blocked analysis, OR if |
covars |
Either a named list with covariates, OR if |
test |
Character. Which test to include. See |
effectSizes |
Numeric. The effect sizes for the spike-ins. Default |
alpha.p |
p-value threshold for false positive rates. Default 0.05 |
alpha.q |
q-value threshold for determining significance for |
p.adj |
Character. Method for p-value adjustment. See |
R |
Integer. Number of times to run the tests. Default 5 |
relative |
Logical. TRUE (default) for compositional data, FALSE for absolute abundances or pre-normalized data. |
k |
Vector of length 3. Number of Features to spike in each tertile (lower, mid, upper). E.g. |
cores |
Integer. Number of cores to use for parallel computing. Default one less than available. Set to 1 for sequential computing. |
args |
List. A list with arguments passed to method. |
out.all |
If TRUE linear models will output results and p-values from |
core.check |
If TRUE will make an interactive check that the amount of cores specified are desired. Only if |
verbose |
If TRUE will print informative messages |
Currently implemented methods: see testDA
An object of class DAPower, which contains a list with 1: A data.frame with results, 2: alpha.p value, 3: alpha.q value
# Creating random count_table and predictor
set.seed(5)
mat <- matrix(rnbinom(1000, size = 0.5, mu = 500), nrow = 50, ncol = 20)
rownames(mat) <- 1:50
pred <- c(rep("Control", 10), rep("Treatment", 10))
# Running powerDA on Wilcoxon test to test it with different effect sizes
# This example uses 1 core (cores = 1).
# Remove the cores argument to get it as high (and thereby fast) as possible.
res <- powerDA(data = mat, predictor = pred, test = "wil", cores = 1)
summary(res)
# Include a paired variable for dependent/blocked samples
subject <- rep(1:10, 2)
res <- powerDA(data = mat, predictor = pred, paired = subject, test = "ttt", cores = 1)
# Include covariates
covar1 <- rnorm(20)
covar2 <- rep(c("A","B"), 10)
res <- powerDA(data = mat, predictor = pred,
covars = list(FirstCovar = covar1, CallItWhatYouWant = covar2),
test = "lrm", cores = 1)
# Data is absolute abundance
res <- powerDA(data = mat, predictor = pred, relative = FALSE, test = "ttt", cores = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.