The function may be called by the names: g08aec, nag_nonpar_test_friedman or nag_friedman_test.
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
g08aec 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 or , tables should be consulted (e.g., n of Siegel (1956)); for the Sign test (see g08aac) or Wilcoxon test (see g08agc) is in any case more appropriate.
Siegel S (1956) Non-parametric Statistics for the Behavioral Sciences McGraw–Hill
1: – IntegerInput
, the number of samples.
2: – IntegerInput
On entry: the size of each sample, .
3: – const doubleInput
On entry: must be set to the value, , of observation in sample , for and .
4: – IntegerInput
On entry: the stride separating matrix column elements in the array x.
5: – double *Output
On exit: the value of the Friedman test statistic, .
6: – double *Output
On exit: the approximate significance, , of the Friedman test statistic.
7: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
On entry, while . These arguments must satisfy .
Dynamic memory allocation failed.
On entry, .
On entry, .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
For estimates of the accuracy of the significance , see g01ecc. The approximation is acceptable unless and , or and , or and .
8Parallelism and Performance
g08aec is not threaded in any implementation.
The time taken by g08aec is approximately proportional to the product .
If , the Sign test (see g08aac) or Wilcoxon test (see g08agc) is more appropriate.
This example is taken from page 169 of Siegel (1956). The data relate to training scores of three matched samples of 18 rats, trained under three different patterns of reinforcement.