corr.test(x, y = NULL, use = "pairwise",method="pearson",adjust="holm")
corr.p(r,n,adjust="holm")
p.adjust
for details about why to use "holm" rather than "bonferroni").cor
function to find the correlations, and then applies a t-test to the individual correlations using the formula
$$t = \frac{r * \sqrt(n-2)}{\sqrt(1-r^2)}$$The probability values may be adjusted using the Holm (or other) correction. If the matrix is symmetric (no y data), then the original p values are reported below the diagonal and the adjusted above the diagonal. Otherwise, all probabilities are adjusted (unless adjust="none"). This is made explicit in the output.
cor.test
for tests of a single correlation, Hmisc::rcorr for an equivalant function, r.test
to test the difference between correlations, and cortest.mat
to test for equality of two correlation matrices. In particular, see p.adjust
for a discussion of p values associated with multiple tests.
data(sat.act)
corr.test(sat.act)
corr.test(sat.act[1:3],sat.act[4:6]) #reports all values corrected for multiple tests
corr.test(sat.act[1:3],sat.act[4:6],adjust="none") #don't adjust the probabilities
Run the code above in your browser using DataLab