PermutationCorr: Permutation based p-value for Pearson's correlation...

View source: R/stats.R

PermutationCorrR Documentation

Permutation based p-value for Pearson's correlation coefficient

Description

Calculate permutation based p-value for Pearson's correlation coefficient.

Usage

PermutationCorr(x, y, R = 999, seed = 1, return.permutation = FALSE)

Arguments

x

A numerical vector with the first variable.

y

A numerical vector with the second variable.

R

The number of permutations to be conducted, set to 999 by default.

seed

Random seed used. Default is 1.

return.permutation

Return permutations. Default is FALSE.

Details

It's adapted from permcor function in Rfast with corrections in calculating the number of permutations and the p-values.

Value

A list containing the following:

  • correlation, Pearson's correlation coefficient.

  • p.val, permutation based p-value.

  • return.permutation, permutation used if returned.

Examples

{
x <- iris[, 1]
y <- iris[, 2]
res <- PermutationCorr(x, y, R = 9999)
}


stevexniu/spots documentation built on July 30, 2022, 9:21 a.m.