Dear all,

I am calculating each-against-each correlations for a number of
variables, in order to use the correlations as distances. This is easy
enough using just cor(), but not if I want to have a p-value for each
calculated correlation, and especially if I want to correct them for
multiple testing (but see below). I do that currently "on foot",
looping around the variables to apply cor.test to each combination of
two variables. Is there a function or a package that would do that for
me?

Specifically, what I do is

# a is the data matrix
for( i in 1:ncol( a ) ) {
  for( j in (i+1):ncol(a) ) {
    result <- cor.test( a[,i], a[,j], method="spear" )
    # store the result somehow
  }
}

This is slow and I seek a better solution.

As I mentioned before, I correct the p-values using Bonferroni
correction, which does not assume independence of the hypotheses to be
tested (obviously that is the case here). However, is there a better
method to do this? Bonferroni results in a large number of false
negatives.

Kind regards,

j.

-- 
-------- Dr. January Weiner 3 --------------------------------------

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to