The Friedman test investigates the score differences between
matched samples of size
, the scores in the
th sample being denoted by
(Thus the sample scores may be regarded as a two-way table with
rows and
columns.) The hypothesis under test,
, often called the null hypothesis, is that the samples come from the same population, and this is to be tested against the alternative hypothesis
that they come from different populations.
The test is based on the observed distribution of score rankings between the matched observations in different samples.
The test proceeds as follows
-
(a)The scores in each column are ranked, denoting the rank within column of the observation in row . Average ranks are assigned to tied scores.
-
(b)The ranks are summed over each row to give rank sums , for .
-
(c)The Friedman test statistic is computed, where
g08aef returns the value of
, and also an approximation,
, to the significance of this value. (
approximately follows a
distribution, so large values of
imply rejection of
).
is rejected by a test of chosen size
if
. The approximation
is acceptable unless
and
, or
and
, or
and
; for
, tables should be consulted (e.g.,
Siegel (1956)); for
the Sign test (see
g08aaf) or Wilcoxon test (see
g08agf) is in any case more appropriate.
-
1:
– Real (Kind=nag_wp) array
Input
-
On entry: must be set to the value, , of observation in sample , for and .
-
2:
– Integer
Input
-
On entry: the first dimension of the array
x as declared in the (sub)program from which
g08aef is called.
Constraint:
.
-
3:
– Integer
Input
-
On entry: , the number of samples.
Constraint:
.
-
4:
– Integer
Input
-
On entry: , the size of each sample.
Constraint:
.
-
5:
– Real (Kind=nag_wp) array
Workspace
-
6:
– Real (Kind=nag_wp) array
Workspace
-
-
7:
– Real (Kind=nag_wp)
Output
-
On exit: the value of the Friedman test statistic, .
-
8:
– Real (Kind=nag_wp)
Output
-
On exit: the approximate significance, , of the Friedman test statistic.
-
9:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended.
When the value or is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
For estimates of the accuracy of the significance
, see
g01ecf. The
approximation is acceptable unless
and
, or
and
, or
and
.
This example is taken from page 169 of
Siegel (1956). The data relates to training scores of three matched samples of
rats, trained under three different patterns of reinforcement.