Illustration of Cochran test for two-way layouts with 0,1 (dichotomous) data Success for four methods of soothing newborn babies Source: Lehmann ``Nonparametrics: Statistical methods based on ranks'' pages 267-270 See Lehmann p283 for the full data set. k=4 treatment groups and n=12 subjects: Starting random-number seed: 408408 (Enter a number on the command line to specify a different seed.) Table of treatment group headings: WrmWa - WarmWater Rockg - Rocking Pacif - Pacifier Sound - Sound Dichotomous data in a two-way layout: WrmWa Rockg Pacif Sound Block sum 1. 0 0 0 0 0 2. 0 1 0 0 1 3. 0 0 1 0 1 4. 0 0 0 0 0 5. 1 1 1 1 4 6. 0 1 1 1 3 7. 1 1 0 0 2 8. 0 1 0 1 2 9. 0 1 1 1 3 10. 0 0 1 0 1 11. 1 1 0 1 3 12. 1 1 1 1 4 Treatment group sums: 4 8 6 6 24 Applying the Cochran test: Treatment sums: 4 8 6 6 Total: 24 Block sums: 0 1 1 0 4 3 2 2 3 1 3 4 Cochran statistics: L2sum=152 CC=3.69231 Large sample approximation: C=3.69231 P=0.2967 df=3 Permutation test for L2sum=152 using 100000 sets of within-block permutations: P = 33408/100000 = 0.3341 95% CI (0.331, 0.334, 0.337) Apply the Friedman procedure as a comparison: Data with Friedman (within-block) ranks: WarmWater Rocking Pacifier Sound 1. 0 (2.5) 0 (2.5) 0 (2.5) 0 (2.5) 2. 0 (2) 1 (4) 0 (2) 0 (2) 3. 0 (2) 0 (2) 1 (4) 0 (2) 4. 0 (2.5) 0 (2.5) 0 (2.5) 0 (2.5) 5. 1 (2.5) 1 (2.5) 1 (2.5) 1 (2.5) 6. 0 (1) 1 (3) 1 (3) 1 (3) 7. 1 (3.5) 1 (3.5) 0 (1.5) 0 (1.5) 8. 0 (1.5) 1 (3.5) 0 (1.5) 1 (3.5) 9. 0 (1) 1 (3) 1 (3) 1 (3) 10. 0 (2) 0 (2) 1 (4) 0 (2) 11. 1 (3) 1 (3) 0 (1) 1 (3) 12. 1 (2.5) 1 (2.5) 1 (2.5) 1 (2.5) AvRanks: (2.17) (2.83) (2.50) (2.50) Carrying out classical Friedman test: 4 treatments, 12 subjects Friedman statistic S'=3.69231 P=0.2967 (3 df, 14 tiegroups) WITH NO TIE CORRECTION: Friedman statistic S=1.60000 P=0.6594 (3 df) Simulating the Friedman P-value using 100000 permutations: Friedman score (for simulations): 3632 P = 33465/100000 = 0.3347 95% CI (0.332, 0.335, 0.338) Random numbers used: 7,200,000