How to test the significant difference between two correlation coefficients? Suppose I have three variables, $X, Y, Z$. And I am interested in knowing how $X, Z$ are correlated to $Y$. Suppose that $$
corr(Y, X) = a=0.6; \quad \text{and} \quad corr(Y, Z) = b=0.4;
$$
My question is, is there a way to test the whether the two correlation coefficients are significantly different? Or am I going to the wrong direction when doing this?
 A: Here is an R package that examines the difference between correlation coefficients for dependent or independent groups.
The specific function is given below:
cocor(formula, data, alternative = "two.sided", test = "all",
na.action = getOption("na.action"), alpha = 0.05, conf.level = 0.95,
null.value = 0, return.htest = FALSE)

This package is based on the following paper by GY Zou entitled Toward using confidence intervals to compare correlations.
In the example in the R package, the dataset  aptitude  is used:
 # Compare two correlations based on two depenendent groups
 # The correlations are overlapping

 cocor(~knowledge + intelligence.a | logic + intelligence.a, aptitude$sample1)
 cocor(~knowledge + intelligence.a | logic + intelligence.a, aptitude$sample2)

This code performs a significance test to examine whether $\text{corr}(\text{knowledge}, \text{intelligence})$ and $\text{corr}(\text{logic}, \text{intelligence})$ are significantly different. Note that the shared variable is  intelligence . The  sample1  and  sample2  are the two dependent groups.
