To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com. Lehmann`s mathod of aligned ranks for two-way layouts Data X(i,j) where 1 le i le nn Subjects or Blocks 1 le j le kk Treatments or Treatment Groups Model: x(i,j) = theta_i + tau_j + error Testing H_0: tau_j=tau_1, so no treatment effect Example: Responses to suggestion under hypnosis as measured by electrical skin potential in millivolts From: Lehmann, ``Nonparametrics: Statistical Methods Based on Ranks`` page 264 (see also pp264-271) k=4 treatment groups and n=8 subjects Treatment groups: 1. Fear 2. Happiness 3. Depression 4. Calmness n=8 blocks (subjects) and k=4 treatment groups Subject, Fear, Happiness, Depression, Calmness 1. 23.10 22.70 22.50 22.60 2. 57.60 53.20 53.70 53.10 3. 10.50 9.70 10.80 8.30 4. 23.60 19.60 21.10 21.60 5. 11.90 13.80 13.70 13.30 6. 54.60 47.10 39.20 37.00 7. 21.00 13.60 13.70 14.80 8. 20.30 23.60 16.30 14.80 First, let`s apply Friedman`s test: Data with (within-block) Friedman ranks: 1. 23.10(4.0) 22.70(3.0) 22.50(1.0) 22.60(2.0) 2. 57.60(4.0) 53.20(2.0) 53.70(3.0) 53.10(1.0) 3. 10.50(3.0) 9.70(2.0) 10.80(4.0) 8.30(1.0) 4. 23.60(4.0) 19.60(1.0) 21.10(2.0) 21.60(3.0) 5. 11.90(1.0) 13.80(4.0) 13.70(3.0) 13.30(2.0) 6. 54.60(4.0) 47.10(3.0) 39.20(2.0) 37.00(1.0) 7. 21.00(4.0) 13.60(1.0) 13.70(2.0) 14.80(3.0) 8. 20.30(3.0) 23.60(4.0) 16.30(2.0) 14.80(1.0) Rank sums and rank averages for each treatment group: 1. 27.00 3.38 2. 20.00 2.50 3. 19.00 2.38 4. 14.00 1.75 Friedman test: With no tie correction: S=6.45000 P= 0.0917 (df=3) With tie correction: Tiesum=0 Tiecorr=0 SP=6.45000 P= 0.0917 (df=3) Carrying out Nsims=10000 Friedman permutations: Initializing the random-number generator at 12345678 Fscore = Sum of Squares over Treatment Groups of Treatment-Group Rank Sums: Observed Fscore=1686 Number of simulations with values >= Fscore and total number: 957 10000 95% CI for true P-value bracketing estimate of true pvalue: (Since H and Fscore >= 0, P-values are inherently two-sided.) 0.0899 0.0957 0.1015 Is the Friedman test the most appropriate? Data again with RANGE (Max-Min for each subject): Note that the RANGE is highly variable across subjects. The Friedman test does not take RANGE into account. Subject, Fear, Happiness, Depression, Calmness, (RANGE, rank) 1. 23.10 22.70 22.50 22.60 ( 0.60) (1) 2. 57.60 53.20 53.70 53.10 ( 4.50) (5) 3. 10.50 9.70 10.80 8.30 ( 2.50) (3) 4. 23.60 19.60 21.10 21.60 ( 4.00) (4) 5. 11.90 13.80 13.70 13.30 ( 1.90) (2) 6. 54.60 47.10 39.20 37.00 (17.60) (8) 7. 21.00 13.60 13.70 14.80 ( 7.40) (6) 8. 20.30 23.60 16.30 14.80 ( 8.80) (7) Perhaps we should weight higher those subjects with higher range? The Wilcoxon signed-rank test effectively does this. The following procedure accomplishes this, but does not reduce to the Wilcoxon signed-rank test if k=2. Data centered at block (subject) means: Subject, Fear, Happiness, Depression, Calmness, RANGE, Subject mean 1. 0.38 -0.03 -0.23 -0.13 ( 0.60) (22.73) 2. 3.20 -1.20 -0.70 -1.30 ( 4.50) (54.40) 3. 0.68 -0.13 0.98 -1.52 ( 2.50) ( 9.82) 4. 2.13 -1.88 -0.38 0.13 ( 4.00) (21.48) 5. -1.28 0.63 0.52 0.13 ( 1.90) (13.18) 6. 10.13 2.63 -5.27 -7.48 (17.60) (44.48) 7. 5.23 -2.17 -2.07 -0.97 ( 7.40) (15.77) 8. 1.55 4.85 -2.45 -3.95 ( 8.80) (18.75) Data centered at block means with Kruskal-Wallis ranks and RANK RANGE: 1. 0.38(21.0) -0.03(18.0) -0.23(15.0) -0.13(16.5) ( 6.0) 2. 3.20(29.0) -1.20(11.0) -0.70(13.0) -1.30( 9.0) (20.0) 3. 0.68(24.0) -0.13(16.5) 0.98(25.0) -1.52( 8.0) (17.0) 4. 2.13(27.0) -1.88( 7.0) -0.38(14.0) 0.13(19.5) (20.0) 5. -1.28(10.0) 0.63(23.0) 0.52(22.0) 0.13(19.5) (13.0) 6. 10.13(32.0) 2.63(28.0) -5.27( 2.0) -7.48( 1.0) (31.0) 7. 5.23(31.0) -2.17( 5.0) -2.07( 6.0) -0.97(12.0) (26.0) 8. 1.55(26.0) 4.85(30.0) -2.45( 4.0) -3.95( 3.0) (27.0) Note that RANGE is still highly variable, but not as variable for the Kruskal-Wallis ranks as for the original data. Rank sums and rank averages for each treatment group: Rank averages appear to be more variable than with Friedman ranks 1. 200.00 25.00 2. 138.50 17.31 3. 101.00 12.63 4. 88.50 11.06 Large-sample Aligned Rank test: Q=8.52954 P=0.0362 (df=3) Carrying out Nsims=10000 Friedman permutations using ALscore = Sum of Squares over Treatment Groups of Treatment-Group Rank Sums: Observed ALobs=77215.5 Number of simulations with values >= ALobs and total number: 241 10000 95% CI for true P-value bracketing estimate of true pvalue: (Since H and Fscore >= 0, P-values are inherently two-sided.) 0.0211 0.0241 0.0271 Thus these data are significant for Lehmann`s Aligned Rank test, but not for Friedman`s test.