SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

FRIEDMAN TEST

Name:
    FRIEDMAN TEST
Type:
    Analysis Command
Purpose:
    Perform a Friedman test that k treatments are identical.
Description:
    The Friedman test is a non-parametric test for analyzing randomized complete block designs. It is an extension of the sign test when there may be more than two treatments.

    The Friedman test assumes that there are k experimental treatments (k ≥ 2). The observations are arranged in b blocks, that is

        Treatment
      Block 1 2 ... k
      1 X11 X12 ... X1k
      2 X21 X22 ... X2k
      3 X31 X32 ... X3k
      ... ... ... ... ...
      b Xb1 Xb2 ... Xbk

    Let R(Xij) be the rank assigned to Xij within block i (i.e., ranks within a given row). Average ranks are used in the case of ties. The ranks are summed to obtain

      \( R_{j} = \sum_{i=1}^{b}{R(X_{ij})} \)

    Then the Friedman test is

    H0: The treatment effects have identical effects
    Ha: At least one treatment is different from at least one other treatment
    Test Statistic: \( T_{1} = \frac{12}{bk(k+1)} \sum_{i=1}^{k}{(R_i - b(k+1)/2)^2} \)

    If there are ties, then

    \( T_{1} = \frac{(k-1)\sum_{i=1}^{k}{(R_i - \frac{b(k+1)}{2})^2}}{A_1 - C_1} \)

    where

    \( A_1 = \sum_{i=1}^{b}{\sum_{j=1}^{k}{(R(X_{ij}))^2}} \)

    \( C_1 = \frac{bk(k+1)^2}{4} \)

    Note that Conover recommends the statistic

    \( T_{2} = \frac{(b-1)T_{1}}{b(k-1) - T_{1}} \)

    since it has a more accurate approximate distribution. The T2 statistic is the two-way analysis of variance statistic computed on the ranks R(Xij).

    Significance Level: \( \alpha \)
    Critical Region: \( T_{2} > F_{(\alpha,k-1,(b-1)(k-1))} \)

    where F is the percent point function of the F distributuion.

    \( T_{1} > \chi_{(\alpha,k-1)}^{2} \)

    where \( \chi^{2} \) is the percent point function of the chi-square distribution.

    The T1 approximation is sometimes poor, so the T2 approximation is typically preferred.

    Conclusion: Reject the null hypothesis if the test statistic is in the critical region.

    If the hypothesis of identical treatment effects is rejected, it is often desirable to determine which treatments are different (i.e., multiple comparisons). Treatments i and j are considered different if

      \( |R_{j} - R_{i}| > t_{(1-\alpha/2,(b-1)(k-1))} \sqrt{\frac{2(bA_1 - \sum_{j=1}^{k}{R_j^2})}{(b-1)(k-1)}} \)
Syntax:
    FRIEDMAN TEST <y> <block> <treat>
                            <SUBSET/EXCEPT/FOR qualification>
    where <y> is the response variable;
                <block> is a variable that identifies the block;
                <treat> is a variable that identifies the treatment;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    FRIEDMAN TEST Y BLOCK TREATMENT
    FRIEDMAN TEST Y X1 X2
    FRIEDMAN TEST Y BLOCK TREATMENT SUBSET BLOCK > 2
Note:
    In Dataplot, the variables should be given as:

      Y BLOCK TREAT

      X11 1 1
      X12 1 2
      ... 1 ...
      X1k 1 k
      X21 2 1
      X22 2 2
      ... 2 ...
      X2k 2 k
      ... ... ...
      Xb1 b 1
      Xb2 b 2
      ... b ...
      Xbk b k

    If your data are in a format similar to that given in the DESCRIPTION section (i.e., you have colums Y1 to Yk, each with b rows), you can convert it to the format required by Dataplot with the commands:

      LET NBLOCK = SIZE Y1
      LET BLOCKID = SEQUENCE 1 1 NBLOCK
      LET Y BLOCK TREAT = REPLICATED STACK Y1 Y2 Y3 Y4 Y5 BLOCKID
      FRIEDMAN TEST Y BLOCK TREAT
Note:
    The response, ranked response, block, and treatment are written to the file dpst1f.dat in the current directory.

    The treatment ranks and multiple comparisons are written to the file dpst2f.dat in the current directory. Comparisons that are statistically significant at the 95% level are flagged with a single asterisk while comparisons that are statistically significant at the 99% level are flagged with two asterisks.

Note:
    The Friedman test is based on the following assumptions:

    1. The b rows are mutually independent. That is, the results within one block (row) do not affect the results within other blocks.

    2. The data can be meaningfully ranked.
Note:
    The following statistics are also supported:

      LET A = FRIEDMAN TEST Y X1 X2
      LET A = FRIEDMAN TEST CDF Y X1 X2
      LET A = FRIEDMAN TEST PVALUE Y X1 X2

    Enter HELP STATISTICS to see what commands can use these statistics.

Note:
    The Quade test is similar to the Friedman test. A few distinctions:

    1. For k = 2, the Friedman test is equivalent to a sign test while the Quade test is equivalent to a signed rank test.

    2. According to Conover, the Quade test is typically more powerful for k < 5 while the Friedman test tends to become more powerful for k ≥ 5.

    3. The Friedman test only requires ordinal scale data (i.e., the data can be ranked) while the Quade test requires at least interval scale data (the range within a block can be computed).
Default:
    None
Synonyms:
    None
Related Commands: Reference:
    Conover (1999), "Practical Nonparametric Statistics," Third Edition, Wiley, pp. 367-373.
Applications:
    Analysis of Variance
Implementation Date:
    2004/1
    2011/4: Reformatted Output
Program:
    SKIP 25
    READ FRIEDMAN.DAT Y BLOCK TREAT
    SET WRITE DECIMALS 5
    FRIEDMAN Y BLOCK TREAT
        
    The following output is generated.
                Friedman Two Factor Test
     
    Response Variable: Y
    First Group-ID Variable: BLOCK
    Second Group-ID Variable: TREAT
     
    H0: Treatments Have Identical Effects
    Ha: Treatments Do Not Have Identical Effects
     
    Summary Statistics:
    Total Number of Observations:                            48
    Number of Blocks:                                        12
    Number of Treatments:                                     4
     
    Test:
    Friedman Test Statistic (Original):                 8.09734
    Sum of Squares of Ranks (A1):                     356.50000
    Correction Factor (C1):                           300.00000
    Friedman Test Statistic (Conover):                  3.19219
    CDF of Test Statistic:                              0.96378
    P-Value:                                            0.03621
     
     
    Percent Points of the F Reference Distribution
    -----------------------------------
      Percent Point               Value
    -----------------------------------
                0.0    =          0.000
               50.0    =          0.805
               75.0    =          1.435
               90.0    =          2.258
               95.0    =          2.891
               97.5    =          3.543
               99.0    =          4.437
               99.9    =          6.883
     
     
    Conclusions (Upper 1-Tailed Test)
    ----------------------------------------------
      Alpha    CDF   Critical Value     Conclusion
    ----------------------------------------------
        10%    90%            2.258      Reject H0
         5%    95%            2.891      Reject H0
       2.5%  97.5%            3.543      Accept H0
         1%    99%            4.437      Accept H0
        
Date created: 02/03/2004
Last updated: 12/11/2023

Please email comments on this WWW page to alan.heckert@nist.gov.