Illustration of Friedman and Aligned-Rank tests for two-way layouts (Page test included for completeness) Amounts of physical responses to suggestion under hypnosis as measured by electrical skin potential in millivolts Source: Lehmann, ``Nonparametrics: Statistical Methods Based on Ranks'' page 264 (see also pp264-271) k=4 treatment groups and n=8 subjects: Starting random-number seed: 123456 (Enter a number on the command line to specify a different seed.) Data with Friedman (within-block) ranks: Fear Happiness Depression Calmness 1. 23.1 (4) 22.7 (3) 22.5 (1) 22.6 (2) 2. 57.6 (4) 53.2 (2) 53.7 (3) 53.1 (1) 3. 10.5 (3) 9.7 (2) 10.8 (4) 8.3 (1) 4. 23.6 (4) 19.6 (1) 21.1 (2) 21.6 (3) 5. 11.9 (1) 13.8 (4) 13.7 (3) 13.3 (2) 6. 54.6 (4) 47.1 (3) 39.2 (2) 37.0 (1) 7. 21.0 (4) 13.6 (1) 13.7 (2) 14.8 (3) 8. 20.3 (3) 23.6 (4) 16.3 (2) 14.8 (1) AvRanks: (3.38) (2.50) (2.38) (1.75) Carrying out classical Friedman test: 4 treatments, 8 subjects Friedman statistic S'=6.45000 P=0.0917 (3 df, 0 tiegroups) Simulating the Friedman P-value using 100000 permutations: Friedman score (for simulations): 1686 P = 9509/100000 = 0.0951 95% CI (0.093, 0.095, 0.097) The Page test: 4 treatments, 8 subjects Page statistic L=180 E(L)=200 Centered=20 Z=-2.44949 P=0.0143 (two-sided) Simulating the Page P-value using 100000 permutations based on two-sided Page score: 20 P = 1498/100000 = 0.01498 95% CI (0.0142, 0.0150, 0.0157) Data centered at block means with Kruskal-Wallis ranks: Fear Happiness Depression Calmness 1. 0.38 (21) -0.03 (18) -0.23 (15) -0.13 (16.5) 2. 3.20 (29) -1.20 (11) -0.70 (13) -1.30 (9) 3. 0.68 (24) -0.13 (16.5) 0.98 (25) -1.52 (8) 4. 2.13 (27) -1.88 (7) -0.38 (14) 0.13 (19.5) 5. -1.28 (10) 0.63 (23) 0.52 (22) 0.13 (19.5) 6. 10.13 (32) 2.63 (28) -5.27 (2) -7.48 (1) 7. 5.23 (31) -2.17 (5) -2.07 (6) -0.97 (12) 8. 1.55 (26) 4.85 (30) -2.45 (4) -3.95 (3) AvRanks: (25.00) (17.31) (12.63) (11.06) Lehmann statistic Q=8.52954 P=0.03625 (3 df, 2 tiegroups) Lehmann score for permutations: 77215.5 Simulating the aligned-rank P-value using 100000 permutations: P = 2344/100000 = 0.0234 95% CI (0.0225, 0.0234, 0.0244) Random numbers used: 7,200,000