FAQ/fried - CBU statistics Wiki
location: FAQ / fried

Post-hoc nonparametric pairwise comparisons of a one-way within subjects factor

(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 Dunn's test (See also Hollander and Wolfe, 1999). Field (2013) gives some illustrations of its use).

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).

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 spreadsheet.

References

Field A (2013) Discovering statistics using IBM SPSS Statistics. Fourth Edition. Sage:London.

Hollander M. & Wolfe D.A. (1999) Nonparametric statistical methods. Second Edition. Wiley:New York

Siegel S., & Castellan N. J. Jr. (1988, 2nd ed.) Nonparametric statistics for the behavioral sciences. New York: McGraw–Hill. (First edition (1981) in CBSU library).

Sprent P., Smeetom, NC (2001) Applied nonparametric statistical methods. Chapman and Hall:London. Details of the post-hoc tests.

* Compares test performance (rows)
* over time at pre, mid and post (columns)
*
* 

data list free/
t1 t2 t3.

begin data
1 3 5
21 25 27
0.2 0.1 0.1
2  1  3
end data.


* 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


define pairf( !pos !tokens(1)
             /!pos !tokens(1)
             /!pos !tokens(1)).
 

VARSTOCASES /ID = id
 /MAKE test FROM t1 to !concat(t,!3)
 /INDEX = time(3)
 /KEEP =
 /NULL = KEEP.


RANK VARIABLES=test (A) by id
/RANK 
/PRINT=YES 
/TIES=MEAN . 
compute rtestsq=rtest*rtest. 
exe. 

aggregate outfile=*
/break = time
/rtsum rtsumsq=sum(rtest rtestsq)
/nsize = n(rtest).

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". 

!enddefine.

pairf 1 3 3.

None: FAQ/fried (last edited 2014-01-22 15:38:25 by PeterWatson)