permutation_correlation_test | R Documentation |
Compute a correlation value for every row of X against the vector y and n random permutations of y. If the number of possible permutations is less than the the argument n_perm then an exact test is performed instead. In both cases the function returns a data.frame of the original data with additional columns for the test statistic, empirical p-value, and FDR corrected empirical p-value.
permutation_correlation_test(X, y, n_perm = 10000, n_core = 1, ...)
X |
numeric matrix or data.frame that can be converted to a numeric matrix |
y |
numeric vector of values to correlate with rows of X |
n_perm |
integer. The desired number of permutations to sample from. Default (10,000) |
n_core |
integer. The number of cores to use for processing. Default (1) |
... |
Additional arguments to pass to 'cor' function |
# generate example data
X <- matrix(runif(1e3 * 10), nrow = 1e3, ncol = 10)
y <- 1:10
dimnames(X) <- list(paste("feature", 1:1e3, sep = "."), paste("sample", 1:10, sep = "."))
# correlate each row of X with 1,000 random permutations of vector y
res <- permutation_correlation_test(X, y, n_perm = 1e3, n_core = 8, method = "spearman")
head(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.