Mood's and David's tests investigate the difference between the dispersions of two independent samples of sizes
and
, denoted by
and
The hypothesis under test,
, often called the null hypothesis, is that the dispersion difference is zero, and this is to be tested against a one- or two-sided alternative hypothesis
(see below).
Both tests are based on the rankings of the sample members within the pooled sample formed by combining both samples. If there is some difference in dispersion, more of the extreme ranks will tend to be found in one sample than in the other.
The returned value
(
or
) can be used to perform a significance test, against various alternative hypotheses
, as follows.
-
(i): dispersions are unequal. is rejected if .
-
(ii): dispersion of sample dispersion of sample . is rejected if .
-
(iii): dispersion of sample dispersion of sample . is rejected if .
-
1:
– Real (Kind=nag_wp) array
Input
-
On entry: the first
elements of
x must be set to the data values in the first sample, and the next
(
) elements to the data values in the second sample.
-
2:
– Integer
Input
-
On entry: the total of the two sample sizes, ().
Constraint:
.
-
3:
– Integer
Input
-
On entry: the size of the first sample, .
Constraint:
.
-
4:
– Real (Kind=nag_wp) array
Output
-
On exit: the ranks
, assigned to the data values , for .
-
5:
– Integer
Input
-
On entry: the test(s) to be carried out.
- Both Mood's and David's tests.
- David's test only.
- Mood's test only.
Constraint:
, or .
-
6:
– Real (Kind=nag_wp)
Output
-
On exit: Mood's test statistic, , if requested.
-
7:
– Real (Kind=nag_wp)
Output
-
On exit: David's test statistic, , if requested.
-
8:
– Real (Kind=nag_wp)
Output
-
On exit: the lower tail probability, , corresponding to the value of , if Mood's test was requested.
-
9:
– Real (Kind=nag_wp)
Output
-
On exit: the lower tail probability, , corresponding to the value of , if David's test was requested.
-
10:
– 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).
All computations are believed to be stable. The statistics and should be accurate enough for all practical uses.
This example is taken from page 280 of
Cooper (1975). The data consists of two samples of six observations each. Both Mood's and David's test statistics and significances are computed. Note that Mood's statistic is inflated owing to the difference in location of the two samples, the median ranks differing by a factor of two.