SPSS Statistics

 View Only

 Comparison between correlation coefficients

Georgios Christou's profile image
Georgios Christou posted Tue March 25, 2025 02:42 AM

Dear Community,

I am a user of the software IBM SPSS Statistics 28.0 and I have the following question. What statistical test I should use to compare the Spearman correlation coefficients (of the association between two variables) between two independent groups (for example between athletes and nonathletes)?

Thank you in advance.

Kind Regards

Georgios A. Christou, MD, MSc, PhD

Scott Stanley's profile image
Scott Stanley

I have long had this bit of code that seems likely to have been made by Tor Neilands at U of Texas. The data example in it are mine. You enter the data (the correlations for the independent samples, and sample sizes) in the actual syntax file (no data file running), and it creates the data file it needs but really, it's doing all the math within the syntax file itself. I believe it is sound and have used it, though some scholars have suggested that it's not so simple to compare two different correlations. But I think, often, it is. 


* Fisher r to Z testing program. 
* Compares correlations from two independent samples. 
* See Hays (1988), p. 591. 
* Tor Neilands, t.neilands@cc.utexas.edu, Oct. 15, 1999. 
** Begin sample program. 
* Enter correlations into an SPSS database. 
DATA LIST free 
/corr1 corr2. 
BEGIN DATA. 
.67 .35 
END DATA. 
* Define the sample sizes of each group. 
COMPUTE n1 = 39. 
COMPUTE n2 = 65. 
* Convert r values to Z values. 
COMPUTE z1 = .5*LN((1+corr1)/(1-corr1)). 
COMPUTE z2 = .5*LN((1+corr2)/(1-corr2)). 
* Compute the estimated standard error. 
COMPUTE stderr = sqrt((1/(n1-3))+(1/(n2-3))). 
* Compute the final Z value. Evaluate this value. 
* against a standard normal distribution for. 
* statistical significance. 
COMPUTE ztest = (z1-z2)/stderr. 
COMPUTE p_1_tail = 1 - CDF.NORMAL(abs(ztest),0,1). 
COMPUTE p_2_tail = (1 - CDF.NORMAL(abs(ztest),0,1))*2. 
* Print the results. 
LIST. 
** End sample program. 

In the example shown above, the SPSS user inputs two sample correlation coefficients, 
.67 and .35. He then inputs the sizes of the samples - 39 and 65 cases, respectively. 
The program then computes the appropriate Z test for the equality of the two correlations. 
It outputs a one-tailed test of the correlations' equality (represented by the p_1_tail variable) 
as well as a two-tailed test of the same equality (represented by the p_2_tail variable).

Running that example will produce this output: 

   corr1    corr2       n1       n2       z1       z2   stderr    ztest p_1_tail p_2_tail

     .67      .35    39.00    65.00      .81      .37      .21     2.13      .02      .03


Number of cases read:  1    Number of cases listed:  1

Note that you can see that this is an algorithm that others have noted and used as well. If you pull up google gemini and ask this question, you will get a less detailed form of the same method (at least it looks like it is to me!). 

Check carefully for yourself, of course. 

Scott

Scott Stanley's profile image
Scott Stanley

I didn't paste in the question I asked of gemini, but it was this: 

does spss statistics have a routine to compare if two independent samples correlations are significantly different?

Bruce Weaver's profile image
Bruce Weaver

For some reason, I am unable to reply to Scott's post.  Scott, the code you posted looks right for comparing two independent Pearson correlations.  But when you apply Fisher's r-to-Z to a Spearman correlation, the Fieller, Hartley, & Pearson (1957) SE for Zr is SQRT(1.06/(n-3)),   So, you need to tweak your line that computes the SE of the difference:

COMPUTE stderr = sqrt((1.06/(n1-3))+(1.06/(n2-3))). 

I hope this helps.  And I hope this post works, as I keep seeing a "403 Forbidden" message pop up as I compose this reply! 

Cheers,
Bruce

Scott Stanley's profile image
Scott Stanley

Bruce, 

I can see your post! It seems like this system does not have a simple reply button but one has to click the "answer" button on the original question posted. 

Great catch. I'd not registered the Spearman part of Georgios' question. That's a nice comment you have added for adjusting for that. I'm going to make a version of that file I have kept for years for that eventuality. 

Thank you for sending that update, and I hope Gerogios' is able to get his analysis completed! 

Scott

Scott Stanley's profile image
Scott Stanley

In other words, folks looking at this thread. The syntax I posted is for Pearson r not Spearman, but Bruce posted a simple adjustment to make it work for Spearman's rank non-parametric correlation comparison. 

S

Bruce Weaver's profile image
Bruce Weaver

Hi Scott.  Until very recently, there was an option to reply to an individual post.  IDK why it was changed.  But never mind. 

Your summary post is good.  But I think that some readers might be wondering why things need to be different for Spearman correlations, given that Pearson r computed on ranks = the Spearman correlation.  The key here is that even though two methods might yield the same point-estimate of some statistic, it does not follow that both methods yield the same SE and CI.  Here's another example that might make the point more clearly.  If you standardize two variable X and Y, and then regress ZY on ZX (i.e., estimate a simple linear regression model), the slope will be exactly equal to the Pearson correlation between X and Y.  But the 95% CI for that slope is not the correct 95% CI for Pearson r.  For one thing, it will always be symmetrical, whereas the correct CI for Pearson r is only symmetrical if the sample estimate of r is exactly equal to 0.  In all other cases, the correct CI for r is asymmetrical, with the longer "arm" being toward 0.  Some time ago, I created a graph to try to illustrate this.  I'll try to attach it.  It shows the 95% CI for rho (as estimated by Pearson r) for r values ranging from -.9 to .9, with n = 30.  As it shows, the correct CI is only symmetrical when (the sample estimate of) r is exactly 0. 

Cheers,
Bruce

Attachment  View in library