Diff for "FAQ/WilliamsSPSS" - CBU statistics Wiki
location: Diff for "FAQ/WilliamsSPSS"
Differences between revisions 45 and 47 (spanning 2 versions)
Revision 45 as of 2006-07-12 11:05:31
Size: 2032
Editor: pc0082
Comment:
Revision 47 as of 2006-07-12 11:07:25
Size: 2018
Editor: pc0082
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
 * [:FAQ/WilliamsSPSS/Fisher: Comparing two correlations from two independent samples (Fisher's test)]  * [:FAQ/WilliamsSPSS/Fisher:Comparing two correlations from two independent samples (Fisher's test)]
Line 11: Line 11:
 * [:FAQ/WilliamsSPSS/Filon: Comparing two correlations from the same sample with no variables in common eg of form r(AB)=r(XY)]
 * [:FAQ/WilliamsSPSS/Filon:Comparing two correlations from the same sample with no variables in common eg of form r(AB)=r(XY)]
Line 16: Line 15:
 {{{
* Dependent Correlation Comparison Program. 
 . {{{
* Dependent Correlation Comparison Program.
Line 19: Line 18:
* Compares correlation coefficients from the same sample.  * Compares correlation coefficients from the same sample.
Line 21: Line 20:
* See Cohen & Cohen (1983), p. 57.  * See Cohen & Cohen (1983), p. 57.
Line 23: Line 22:
* Sam Field, sfield@mail.la.utexas.edu, March 1, 2000.  * Sam Field, sfield@mail.la.utexas.edu, March 1, 2000.
Line 31: Line 30:
/r12 r13 r23 nsize.  /r12 r13 r23 nsize.
Line 41: Line 40:
END DATA.  END DATA.
Line 51: Line 50:
COMPUTE #diffr = !rxy - !rvy.  COMPUTE #diffr = !rxy - !rvy.
Line 57: Line 56:
COMPUTE #tnum = (#diffr) * (sqrt((!n-1)*(1 + !rxv))).  COMPUTE #tnum = (#diffr) * (sqrt((!n-1)*(1 + !rxv))).
Line 59: Line 58:
COMPUTE #tden = sqrt(2*((!n-1)/(!n-3))*#detR + ((#rbar**2) * ((1-!rxv)**3))).  COMPUTE #tden = sqrt(2*((!n-1)/(!n-3))*#detR + ((#rbar**2) * ((1-!rxv)**3))).
Line 61: Line 60:
COMPUTE t= (#tnum/#tden).  COMPUTE t= (#tnum/#tden).
Line 65: Line 64:
COMPUTE p_1_tail = 1 - CDF.T(abs(t),df).  COMPUTE p_1_tail = 1 - CDF.T(abs(t),df).
Line 69: Line 68:
LIST t df p_1_tail p_2_tail.  LIST t df p_1_tail p_2_tail.

A variable in common (overlap) e.g. of form r(W,X) = r(W,Z).

A test for this comparison goes under various names the Williams test, Williams-Hotelling or Hotelling test.

An example of its use in macro form is given below. This uses SPSS syntax from http://www.utexas.edu/its/rc/answers/general/gen28.html. Just cut and paste into a SPSS syntax window to use. In the syntax window choose select all and click the run arrow. Edit the data in the spreadsheet as required. You can also use the Williams-Hotelling test by typing equalcor at a UNIX prompt on a CBU machine.

More SPSS syntax

  • [:FAQ/WilliamsSPSS/Fisher:Comparing two correlations from two independent samples (Fisher's test)]

  • [:FAQ/WilliamsSPSS/Filon:Comparing two correlations from the same sample with no variables in common eg of form r(AB)=r(XY)]

[CUT AND PASTE ALL BELOW THIS LINE]

  • * Dependent Correlation Comparison Program.
    
    * Compares correlation coefficients from the same sample.
    
    * See Cohen & Cohen (1983), p. 57.
    
    * Sam Field, sfield@mail.la.utexas.edu, March 1, 2000.
    
    * Three pairs of correlations to compare*****
    
    set format f10.5.
    
    DATA LIST free
    
    /r12 r13  r23  nsize.
    
    BEGIN DATA
    
    .50 .32 .65 50
    
    .59 .31 .71 30
    
    .80 .72 .89 26
    
    END DATA.
    
    define williams (rxy = !tokens(1)
    
                          /rvy = !tokens(1)
    
                          /rxv = !tokens(1)
    
                          /n = !tokens(1)).
    
    COMPUTE #diffr = !rxy - !rvy.
    
    COMPUTE #detR = (1 - !rxy **2 - !rvy**2 - !rxv**2)+ (2*!rxy*!rxv*!rvy).
    
    COMPUTE #rbar = (!rxy + !rvy)/2.
    
    COMPUTE #tnum = (#diffr) * (sqrt((!n-1)*(1 + !rxv))).
    
    COMPUTE #tden = sqrt(2*((!n-1)/(!n-3))*#detR + ((#rbar**2) * ((1-!rxv)**3))).
    
    COMPUTE t= (#tnum/#tden).
    
    COMPUTE df = !n - 3.
    
    COMPUTE p_1_tail = 1 - CDF.T(abs(t),df).
    
    COMPUTE p_2_tail = (1 - CDF.T(abs(t),df))*2.
    
    LIST t  df    p_1_tail    p_2_tail.
    
    exe.
    
    !enddefine.
    
    *********************
    
    williams rxy=r12 rvy=r13 rxv=r23 n=nsize.

None: FAQ/WilliamsSPSS (last edited 2021-04-09 11:33:29 by PeterWatson)