Performs Friedman’s nonparametric analysis of variance (S. Langton).

### Options

`PRINT` = string tokens |
Output required (`test` , `ranks` ); default `test` |
---|---|

`TREATMENTS` = factor |
Treatment factor |

`BLOCKS` = factor |
Block factor |

### Parameters

`DATA` = variates |
Identifier of the variate holding the data values |
---|---|

`RANKS` = variates |
Saves the ranks |

`STATISTIC` = scalars |
Saves the test statistic |

`DF` = scalars |
Saves the degrees of freedom for the chi-square approximation |

`PROBABILITY` = scalars |
Saves the probability value for the chi-square statistic |

### Description

Friedman’s test is a nonparametric test for analysing a randomized complete block design. That is, the data consists of observations on *k* treatments assessed under *n* different conditions (blocks). The variate of observations is specified using the `DATA`

parameter, whilst options `TREATMENTS`

and `BLOCKS`

supply the treatment and blocking factors. `FRIEDMAN`

calculates the test statistic together with a probability value based on a chi-square approximation. If sample sizes are small, stored tabulated values are printed in addition.

The `PRINT`

option controls printed output, with settings `test`

to print the various test statistics, and `ranks`

to print the ranks (together with the `BLOCKS`

, `TREATMENTS`

and `DATA`

).

Parameters `RANKS`

, `STATISTIC`

, `DF`

and `PROBABILITY`

can be used to save the ranks, the test statistic (adjusted for ties), the degrees of freedom for the chi-square approximation, and the probability value for the chi-square approximation.

Options: `PRINT`

, `TREATMENTS`

, `BLOCKS`

.

Parameters: `DATA`

, `RANKS`

, `STATISTIC`

, `DF`

, `PROBABILITY.`

### Method

The Friedman test is a test for treatment differences in a randomized complete block design: i.e. a test of the null hypothesis that the samples arise from distributions with the same mean versus the alternative that the distribution means differ. Each block is checked in turn to ensure that it consists of exactly one replicate of each treatment, after excluding any units which are restricted out or which have missing values for `DATA`

, `TREATMENTS`

or `BLOCKS`

. Any block not meeting this condition is excluded from analysis and a warning is printed. The treatments are ranked within each block and the sum of the ranks is calculated for each treatment group over all valid blocks. The sum of the squared values of these rank sums is calculated, as is the sum of the cubed sizes of all groups of ranks (i.e. 1 for an untied observation, 2^{3}=8 for pairs of ties, etc.).

The test statistic is formed using the equation (Siegel & Castellan 1988):

Fr = 12 × *R* / (*n* × *k* × (*k* + 1)) – 3 × *n* × (*k* + 1)

where *R* is the sum of the squared rank sums,

*k* is the number of treatments, and

*n* is the number of blocks.

A version adjusted for ties is also formed, and this version is used for calculating the significance level:

Fr = {12 × *R* – 3 × *n*^{2} × *k* × (*k* + 1)^{2}} / {*n* × *k* × (*k* + 1) + (*n* × *k* – *T*) / (*k* – 1)}

where *T* is the sum of the cubed sizes of rank groups.

### Action with `RESTRICT`

Any units that are restricted for `DATA`

, `BLOCKS`

or `TREATMENTS`

(or which have missing values) are excluded from the analysis. Any block which no longer has one replicate of each treatment as a result of such restrictions is excluded in its entirety.

### Reference

Siegel, S. & Castellan, N.J. (1988). *Nonparametric Statistics for the Behavioural Sciences (second edition)*. McGraw-Hill, New York.

### See also

Procedures: `APERMTEST`

, `A2WAY`

, `KRUSKAL`

.

Commands for: Basic and nonparametric statistics, Analysis of variance.

### Example

CAPTION 'FRIEDMAN example','1) Siegel & Castellan, 1988, p. 176';\ STYLE=meta,plain VARIATE Score READ Score 9 4 1 7 6 5 2 8 9 1 2 6 : FACTOR [LEVELS=3; VALUES=4(1...3)] Group & [LEVELS=4; VALUES=(1...4)3] Condition FRIEDMAN [TREATMENTS=Condition; BLOCKS=Group] Score CAPTION '2) Siegal & Castellan, 1988, p. 179' VARIATE Rank READ Rank 1 3 2 2 3 1 1 3 2 1 2 3 3 1 2 2 3 1 3 2 1 1 3 2 3 1 2 3 1 2 2 3 1 2 3 1 3 2 1 2 3 1 2.5 2.5 1 3 2 1 3 2 1 2 3 1 : FACTOR [LEVELS=18; VALUES=3(1...18)] Group & [LEVELS=3; LABELS=!t(RR,RU,UR); VALUES=(1...3)18] Type FRIEDMAN [TREATMENTS=Type; BLOCKS=Group] Rank