Friedman's two-way ANOVA for ranks
{From the Institute of Phonetic Sciences (IFA): http://www.fon.hum.uva.nl/}

    When either a matched-subjects or repeated-measure design is used and the hypothesis of a difference among three or more treatments is to be tested, the Friedman 2-way ANOVA by ranks provides an acceptable test. Formally, Friedman's test is a nonparametric test for treatment differences in a randomized complete block design. Each block (row) of the design is a subject. Treatments are randomly assigned to subjects within each block. The subjects are repeatedly measured once under each treatment. The order of treatments is randomized for each subject.

    As an example, suppose a teacher, having read that the time of day can affect the performances of children on cognitive tasks, decides to carry out an action research study to determine when best to test children-early morning (EM) late morning (LM) early afternoon (EA) or late afternoon (LA).

    She has a class of 19 students.

    She begins with a list of 100, age/grade-appropriate spelling words and then constructs four unique spelling tests (A, B,C, and D) of 25 words each by randomly selecting 25 words from the list of 100 for the first test, then randomly selecting 25 words from the remaining 75 for the second test, then randomly selecting 25 words from the remaining 50 for the third test, and using the remaining 25 words for the fourth test. After spending two weeks teaching the complete list of 100 words, she waits a week and then performs the "experiment" by administering the four tests over four successive days under the following conditions.

    On Monday she administers a spelling test at 8:30 am; on Tuesday she administers a test at 11: am; on Wednesday she administers a test at 12:30 pm; and on Thursday she administers a test at 2:30 pm. The tests are randomly assigned over children. For instance, the order of tests administered to the first child (S1) might be CADB; for the second child (S2) it might be BCDA, and so on.

    The data (spelling test scores) collected over the four days are shown in the table to right.

 S           EM       LM         EA         LA
 s
1            17          23          24          21
 s2            16          17          24          19
 s3            16          17          21          13
 s4            13          15          19          18
 s5            19          18          22          24

 s6            18          15          18          24
 s7            16          17          20          13
 s8            12          15          15          14
 s9            16          16          22          16
 s10          17          18          18          17

 s11          16          17          24          19
 s12            9          14          17          15
 s13          18          20          25          22
 s14          17          21          24          20
 s15          20          20          25          24

 s16          15          15          19          13
 s17          18          17          20          20
 s18          12          17          17          15
 s19          17          20          21          21

The Friedman test statistic (Qk) is:  

Which is approximated by a P2  statistic with k-1 degrees of freedom.

To compute Qk work through the following steps.

1. Within each row rank-order the k = 4 scores from low to high. The new scores (ranks) are the R's given in the equation above.

2. Sum (over the N=19 cases) the ranked scores for each column, .

3. Square each of the column totals, ; then plug the values into the equation and solve for QR in the equation given above.

    For the data in this example, the ranks (within rows), the column rank sums, and the squares of the column rank sums are given in the table below.

  RANKS (within rows):

  S               REM         RLM          REA         RLA

  s1                1.0            3.0            4.0            2.0
  s2                1.0            2.0            4.0            3.0
  s3                2.0            3.0            4.0            1.0
  s4                1.0            2.0            4.0            3.0
  s5                2.0            1.0            3.0            4.0
  s6                2.5            1.0            2.5            4.0
  s7                2.0            3.0            4.0            1.0
  s8                1.0            3.5            3.5            2.0
  s9                2.0            2.0            4.0            2.0
  s10              1.5            3.5            3.5            1.5
  s11              1.0            2.0            4.0            3.0
  s12              1.0            2.0            4.0            3.0
  s13              1.0            2.0            4.0            3.0
  s14              1.0            3.0            4.0            2.0
  s15              1.5            1.5            4.0            3.0
  s16              2.5            2.5            4.0            1.0
  s17              2.0            1.0            3.5            3.5
  s18              1.0            3.5            3.5            2.0
  s19              1.0            2.0            3.5            3.5

Sum               28           43.5          67.5          43.5
Sum^2          784          1892.25    5041         2256.25


We now have,

N = 19,

k = 4,

R12 = 784,

R22 = 1892.25,

R32 = 5041.00, and

R42 = 2256.25

and we can compute,

QR     = [12 / Nk(k+1)] × [R12 + R22 + R32 + R42] - 3N(k + 1)

= [12 / (19)(4)(5)] × [784 + 1892.25 + 5041 + 2256.25] - 3(19)(5)

= (12 / 180) × 9973.5 - 285

= .06667 × 9973.5 - 285

= 314.65 - 285

= 29.95,

which can be compared to a c2 with k-1 = 3 degrees of freedom.

A computer program is available for computing this statistic. Click here: Friedman's ANOVA by ranks.