Diff for "FAQ/WilliamsSPSS" - CBU statistics Wiki
location: Diff for "FAQ/WilliamsSPSS"
Differences between revisions 1 and 77 (spanning 76 versions)
Revision 1 as of 2006-07-11 14:57:59
Size: 512
Editor: pc0082
Comment:
Revision 77 as of 2008-06-23 15:45:11
Size: 3075
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Comparing pairs of correlations ==

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.

[http://ssc.utexas.edu/consulting/answers/general/gen28.html A macro example is available. ] 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]
 * [:FAQ/WilliamsSPSS/Filon:Comparing two correlations from the same sample with no variables in common eg of form r(A,B)=r(X,Y)]
 * [:FAQ/WilliamsSPSS/Meng:A z-test alternative to Williams-Hotelling for correlation comparisons of form r(W,X)=r(W,Z)]
Some of the above tests may be performed using the free downloadable program [http://www-class.unl.edu/psycrs/statpage/comp.html FZT.EXE] but note FZT.EXE does not compute p-values. Williams test may also be performed using [attachment:Williams-test.xls this spreadsheet].

Also note Algina J and Keselman HJ (1999) give formulae for comparing squared multiple correlations from regressions on different data.

__Reference__

Algina J, Keselman HJ (1999) Comparing squared multiple correlation coefficients: examination of a confidence interval and a test of significance.
''Psychological methods'' '''4(1)''' 76-83.
Line 3: Line 24:
A variable in common (overlap) e.g. of form r(W,X) = r(W,Z). [COPY AND PASTE SPSS SYNTAX '''IN THE BOX BELOW''' TO PERFORM WILLIAMS TEST]
Line 5: Line 26:
A test for this comparison goes under various names the Williams test, Williams-Hotelling or Hotelling test. {{{
* 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.
Line 7: Line 32:
 This can be implemented using SPSS syntax provided at http://www.utexas.edu/its/rc/answers/general/gen28.html . * Three pairs of correlations to compare*****
Line 9: Line 34:
An example of its use together with syntax is given below. Just cut and paste into a SPSS syntax window to use. You can also use the Williams-Hotelling test by typing equalcor at a UNIX prompt on a CBU machine. 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.
}}}

 * Multiple invocations of the macro in the same interactive session will produce the following note:

>The macro name specified on the DEFINE command duplicates the name of a previously defined macro. This instance will take precedence.

This warning does not indicate a problem and may be ignored.

Comparing pairs of correlations

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.

[http://ssc.utexas.edu/consulting/answers/general/gen28.html A macro example is available. ] 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]

  • [:FAQ/WilliamsSPSS/Filon:Comparing two correlations from the same sample with no variables in common eg of form r(A,B)=r(X,Y)]

  • [:FAQ/WilliamsSPSS/Meng:A z-test alternative to Williams-Hotelling for correlation comparisons of form r(W,X)=r(W,Z)]

Some of the above tests may be performed using the free downloadable program [http://www-class.unl.edu/psycrs/statpage/comp.html FZT.EXE] but note FZT.EXE does not compute p-values. Williams test may also be performed using [attachment:Williams-test.xls this spreadsheet].

Also note Algina J and Keselman HJ (1999) give formulae for comparing squared multiple correlations from regressions on different data.

Reference

Algina J, Keselman HJ (1999) Comparing squared multiple correlation coefficients: examination of a confidence interval and a test of significance. Psychological methods 4(1) 76-83.

[COPY AND PASTE SPSS SYNTAX IN THE BOX BELOW TO PERFORM WILLIAMS TEST]

* 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.
  • Multiple invocations of the macro in the same interactive session will produce the following note:

>The macro name specified on the DEFINE command duplicates the name of a previously defined macro. This instance will take precedence.

This warning does not indicate a problem and may be ignored.

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