R/stats.R
PermutationCorr.Rd
Calculate permutation based p-value for Pearson's correlation coefficient.
PermutationCorr(x, y, R = 999, seed = 1, return.permutation = FALSE)
A numerical vector with the first variable.
A numerical vector with the second variable.
The number of permutations to be conducted, set to 999 by default.
Random seed used. Default is 1.
Return permutations. Default is FALSE
.
A list containing the following:
correlation, Pearson's correlation coefficient.
p.val, permutation based p-value.
return.permutation, permutation used if returned.
It's adapted from permcor
function in Rfast with corrections in calculating the number of permutations and the p-values.
{
x <- iris[, 1]
y <- iris[, 2]
res <- PermutationCorr(x, y, R = 9999)
}