FAQ/OMScorrs - CBU statistics Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
Finzd thee wrang lelters ino eacuh wosrd

location: FAQ / OMScorrs

Comparing correlations in matrices from two subgroups

The following syntax produces individual group correlation matrices involving variables, x, saves the output to a SPSS data file and then compares two of the groups using Fisher's transformation (details and exmaples, for example in, Howell, (2002)).

In brief, we can transform a correlation, r, to ,r', where

$$\mbox{r' = 0.5} log_text{e} abs [ \frac{1+r}[1-r} } ]$$.

Now, for a sample of size, N, the transformed correlation, r', follows a normal distribution with a mean of zero and a variance equal to 1/(N-3).

This means we can compare two correlations by comparing their transformed counterparts and so form a z score.

$$z = \frac{r'_text{1} - r'_text{2}}{\sqrt{1/(N_text{1}-3) + 1/(N_text{2}-3)}}$$

The macro below firstly uses the output management system (OMS) to obtain the correlations for two independent groups and then carries out the transformation and finally computes a z score which we can convert to p-values using other functions in SPSS. Any p-value less than 0.05 suggests there is evidence a pair of group correlations differ from one another.

* USING FISHER'S TRANSFORMATION FOR COMPARING TWO CORRELATIONS FROM TWO INDEPENDENT GROUPS

DEFINE !FISH ( GP !TOKENS(1)
             /  X !CMDEND).

SPLIT FILE BY !GP.

OMS 
/SELECT TABLES 
/IF SUBTYPES=['Correlations'] 
/DESTINATION FORMAT=SAV OUTFILE='c:\corrs.sav'
/COLUMNS SEQUENCE=[R3, R1]. 

CORRELATIONS
  /VARIABLES=!X
  /PRINT=TWOTAIL NOSIG
  /MISSING=PAIRWISE .

OMSEND.
!ENDDEFINE.

*
Specify group variable and variables in correlation matrix.

!FISH GP=SEX X=AGE EDUC PRESTG80.

* Edit the correlation data file and perform Fisher's test. 
* OMS creates names of form using the variable label    
* PearsonCorrelation_Var Label which are a bit cumbersome
* so you can rename them as below if you wish and remove 
* extraneous information.


GET FILE  ='C:\CORRS.SAV'.
SAVE OUTFILE='C:\CORRS2.SAV' 
 /DROP=Command_ to Var2 Sig.2tailed_Female Sig.2tailed_Male
 /RENAME=(PearsonCorrelation_Male PearsonCorrelation_Female N_Male N_Female = cm cf nm nf).
exe.
GET FILE='C:\CORRS2.SAV'.

SELECT IF (CF NE 1 AND CM NE 1).
EXE.

FORMAT CF (F5.2) CM (F5.2).

DEFINE !FISH2 ( GP1 !TOKENS(1)
             /  GP2 !TOKENS(1)
             /  NGP1 !TOKENS(1)
             /  NGP2 !TOKENS(1)).

COMPUTE Z= (0.5*LN(ABS((1+!GP1)/(1-!GP1))) - 0.5*LN(ABS((1+!GP2)/(1-!GP2))))  / SQRT( (1/(!NGP1-3)) + (1/(!NGP2-3)) ).
COMPUTE PZ= 2*CDFNORM(-ABS(Z)).
EXE.

SUMMARIZE
/TABLES=!GP1 !GP2 Z PZ
/FORMAT=LIST NOCASENUM NOTOTAL
/TITLE='CORRELATION COMPARISONS FOR MALES AND FEMALES'
/MISSING=VARIABLE
/CELLS=NONE.
!ENDDEFINE.

!FISH2 GP1=CM GP2=CF NGP1=NM NGP2=NF.

Reference

Howell DC (2002) Statistical methods for psychologists. Duxbury Press:Pacific Grove, CA