The routine may be called by the names g08aef or nagf_nonpar_test_friedman.
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.
Siegel S (1956) Non-parametric Statistics for the Behavioral Sciences McGraw–Hill
1: – Real (Kind=nag_wp) arrayInput
On entry: must be set to the value, , of observation in sample , for and .
2: – IntegerInput
On entry: the first dimension of the array x as declared in the (sub)program from which g08aef is called.
3: – IntegerInput
On entry: , the number of samples.
4: – IntegerInput
On entry: , the size of each sample.
5: – Real (Kind=nag_wp) arrayWorkspace
6: – Real (Kind=nag_wp) arrayWorkspace
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: – IntegerInput/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).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
On entry, and .
On entry, .
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
For estimates of the accuracy of the significance , see g01ecf. The approximation is acceptable unless and , or and , or and .
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g08aef is not threaded in any implementation.
The time taken by g08aef is approximately proportional to the product .
If , the Sign test (see g08aaf) or Wilcoxon test (see g08agf) is more appropriate.
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.