jmuOutlier (version 2.2)

perm.cor.test: Permutation Test on Correlation

Description

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

Usage

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.

Value

alternative

Same as the input.

p.value

The p-value of the permutation test.

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.

References

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

See Also

cor, cor.test, and perm.test.

Examples

Run this code
# NOT RUN {
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" )
# }

Run the code above in your browser using DataLab