## generate data
library("mvtnorm")
set.seed(1234) # for reproducibility
p <- 3
q <- 2
m <- p + q
sigma <- 0.5^t(sapply(1:m, function(i, j) abs(i-j), 1:m))
xy <- rmvnorm(100, sigma=sigma)
x <- xy[, 1:p]
y <- xy[, (p+1):m]
## Spearman correlation
permTest(x, y, R=100, method = "spearman")
permTest(x, y, R=100, method = "spearman", consistent = TRUE)
## Pearson correlation
permTest(x, y, R=100, method = "pearson")
Run the code above in your browser using DataLab