perm.cor.test: Permutation Test on Correlation

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/perm.cor.test.R

Description

A permutation test is performed based on Pearson and Spearman correlations.

Usage

1
2
perm.cor.test(x, y = NULL, alternative = c("two.sided", "less", "greater"), 
              method = c("pearson", "spearman"), num.sim = 20000)

Arguments

x

Numeric vector of design variable if y is not NULL, or N by 2 data frame or matrix of design and response variables if y is NULL.

y

Numeric vector of response variable, and should be NULL if x is an N by 2 data frame or matrix.

alternative

A character string specifying the alternative hypothesis, and must be one of "two.sided" (default), "greater" or "less". Only the initial letter needs to be specified.

method

A character string specifying the type of correlation, and must be one of "pearson" (default) or "spearman". Only the initial letter needs to be specified.

num.sim

The number of simulations generated.

Details

The p-value is estimated by randomly generating the permutations, and is hence not exact. The larger the value of num.sim the more precise the estimate of the p-value, but also the greater the computing time. Thus, the p-value is not based on asymptotic approximation. The output states more details about the permutation test, such as the values of method and num.sim.

Value

alternative

Same as the input.

p.value

The p-value of the permutation test.

Note

The formulas computed within perm.cor.test are based on the textbook by Higgins (2004).

Author(s)

Steven T. Garren, James Madison University, Harrisonburg, Virginia, USA

References

Higgins, J. J. (2004) Introduction to Modern Nonparametric Statistics.

See Also

cor, cor.test, and perm.test.

Examples

1
2
perm.cor.test( c( 4, 6, 8, 11 ), c( 19, 44, 15, 13 ), "less", "pearson" ) 
perm.cor.test( c( 4, 6, 8, 11 ), c( 19, 44, 15, 13 ), "less", "spearman" )

Example output

[[1]]
[1] "Permutation correlation test.  Method is pearson"

[[2]]
[1] "p-value was estimated based on 20000 simulations."

$alternative
[1] "less"

$p.value
[1] 0.28875

[[1]]
[1] "Permutation correlation test.  Method is spearman"

[[2]]
[1] "p-value was estimated based on 20000 simulations."

$alternative
[1] "less"

$p.value
[1] 0.171

jmuOutlier documentation built on Aug. 6, 2019, 1:03 a.m.