<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>FAQ/fried</title><revhistory><revision><revnumber>11</revnumber><date>2014-01-22 15:38:25</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>10</revnumber><date>2014-01-22 15:38:05</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>9</revnumber><date>2013-05-31 09:13:27</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>8</revnumber><date>2013-05-31 09:11:55</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>7</revnumber><date>2013-03-08 10:17:16</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>6</revnumber><date>2011-07-27 15:26:48</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>5</revnumber><date>2011-06-22 14:24:31</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>4</revnumber><date>2011-06-22 14:23:35</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>3</revnumber><date>2007-08-16 14:08:43</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>2</revnumber><date>2007-08-16 13:54:13</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>1</revnumber><date>2007-08-16 13:53:15</date><authorinitials>PeterWatson</authorinitials></revision></revhistory></articleinfo><section><title>Post-hoc nonparametric pairwise comparisons of a one-way within subjects factor</title><para>(Note that since the below was written post-hoc tests have now become available in SPSS V18 and later for the nonparametric one-way ANOVA. This procedure uses <ulink url="http://www.graphpad.com/support/faqid/1156/">Dunn's test</ulink> (See also Hollander and Wolfe, 1999). Field (2013) gives some illustrations of its use).  </para><para>The syntax below performs a specified pairwise comparison between a subset pair of groups representing the within subject factor. The overall one-way repeated measures ANOVA, using ranked outcomes to compute and compare group rank sums, should be carried out first using Friedman's test (Siegal and Castellan, 1988). </para><para>Sprent and Smeeton (2001) suggest using an analogous approach to the Least Significant Difference (LSD) parametric approach doing unprotected t-tests on subsets of pairs of groups provided there is an overall significant overall effect using Friedman's test. Post-hocs following a statistically significant Friedman's test can be done using this <ulink url="https://lsr-wiki-02.mrc-cbu.cam.ac.uk/statswiki/FAQ/fried/statswiki/FAQ/fried?action=AttachFile&amp;do=get&amp;target=fph.xls">spreadsheet.</ulink> </para><para><emphasis role="underline">References</emphasis> </para><para>Field A (2013) Discovering statistics using IBM SPSS Statistics. Fourth Edition. Sage:London. </para><para>Hollander M. &amp; Wolfe D.A. (1999) Nonparametric statistical methods. Second Edition.  Wiley:New York </para><para>Siegel S., &amp; Castellan N. J. Jr. (1988, 2nd ed.) Nonparametric statistics for the behavioral sciences. New York: <ulink url="https://lsr-wiki-02.mrc-cbu.cam.ac.uk/statswiki/FAQ/fried/statswiki/McGraw#">McGraw</ulink>–Hill. (First edition (1981) in CBSU library). </para><para>Sprent P., Smeetom, NC (2001) Applied nonparametric statistical methods. Chapman and Hall:London. Details of the post-hoc tests. </para><screen><![CDATA[* Compares test performance (rows)
* over time at pre, mid and post (columns)
*
* 
]]><![CDATA[
data list free/
t1 t2 t3.
]]><![CDATA[
begin data
1 3 5
21 25 27
0.2 0.1 0.1
2  1  3
end data.
]]><![CDATA[
]]><![CDATA[
* macro assumes columns called t1 to tn
* contain matched scores on the within subject
* factor e.g. time.
*
* pairf takes as inputs: the two columns to compare 
* and the total number of columns
*
* output is a t-statistic, its df, p-value
* and the two columns which have been compared
]]><![CDATA[
]]><![CDATA[
define pairf( !pos !tokens(1)
             /!pos !tokens(1)
             /!pos !tokens(1)).
 
]]><![CDATA[
VARSTOCASES /ID = id
 /MAKE test FROM t1 to !concat(t,!3)
 /INDEX = time(3)
 /KEEP =
 /NULL = KEEP.
]]><![CDATA[
]]><![CDATA[
RANK VARIABLES=test (A) by id
/RANK 
/PRINT=YES 
/TIES=MEAN . 
compute rtestsq=rtest*rtest. 
exe. 
]]><![CDATA[
aggregate outfile=*
/break = time
/rtsum rtsumsq=sum(rtest rtestsq)
/nsize = n(rtest).
]]><![CDATA[
matrix.
get m /variables=time rtsum rtsumsq nsize.
compute stsum=make(1,1,0).
loop i = 1 to mmax(m(:,1)).
compute stsum=stsum+((m(i,2))**2)/m(i,4).
end loop.
compute srsum=csum(m(:,3)).
compute tn=mmax(m(:,1)).
compute bn=mmax(m(:,4)).
compute #ct1=m(!1,2)-m(!2,2).
compute ct2=#ct1 / sqrt((2*bn*(srsum-stsum))/((bn-1)*(tn-1))).
compute ct3=1-fcdf(ct2*ct2,1,(bn-1)*(tn-1)).
save {ct2, (bn-1)*(tn-1), ct3, !1, !2} /outfile=*
 /variables=tstat, df, pvalue, group_1, group_2.
end matrix. 
formats tstat (f7.3) df (f4.0) pvalue (f5.3) group_1 (f2.0) group_2 (f2.0).
report format=list automatic align(center) 
/variables=tstat df pvalue group_1 group_2
/title "Unadjusted comparisons for method" 
"of Sprent and Smeeton (2001) for Friedman test" 
" " " NB: This test is only valid if the Friedman test is statistically"
 " significant overall using all the groups". 
]]><![CDATA[
!enddefine.
]]><![CDATA[
pairf 1 3 3.]]></screen></section></article>