NAG Library Routine Document
G08AAF
1 Purpose
G08AAF performs the Sign test on two related samples of size .
2 Specification
INTEGER |
N, ISGN, N1, IFAIL |
REAL (KIND=nag_wp) |
X(N), Y(N), P |
|
3 Description
The Sign test investigates the median difference between pairs of scores from two matched samples of size , denoted by , for . The hypothesis under test, , often called the null hypothesis, is that the medians are the same, and this is to be tested against a one- or two-sided alternative (see below).
G08AAF computes:
(a) |
the test statistic , which is the number of pairs for which ; |
(b) |
the number of non-tied pairs ; |
(c) |
the lower tail probability corresponding to (adjusted to allow the complement to be used in an upper one tailed or a two tailed test). is the probability of observing a value if , or of observing a value if , given that is true. If , is set to . |
Suppose that a significance test of a chosen size
is to be performed (i.e.,
is the probability of rejecting
when
is true; typically
is a small quantity such as
or
). The returned value of
can be used to perform a significance test on the median difference, against various alternative hypotheses
, as follows
(i) |
: median of median of . is rejected if . |
(ii) |
: median of median of . is rejected if . |
(iii) |
: median of median of . is rejected if . |
4 References
Siegel S (1956) Non-parametric Statistics for the Behavioral Sciences McGraw–Hill
5 Parameters
- 1: X(N) – REAL (KIND=nag_wp) arrayInput
- 2: Y(N) – REAL (KIND=nag_wp) arrayInput
On entry: and must be set to the th pair of data values, , for .
- 3: N – INTEGERInput
On entry: , the size of each sample.
Constraint:
.
- 4: ISGN – INTEGEROutput
On exit: the Sign test statistic, .
- 5: N1 – INTEGEROutput
On exit: the number of non-tied pairs, .
- 6: P – REAL (KIND=nag_wp)Output
On exit: the lower tail probability, , corresponding to .
- 7: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value 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).
6 Error 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:
-
-
, i.e., the samples are identical.
7 Accuracy
The tail probability,
, is computed using the relationship between the binomial and beta distributions. For
,
should be accurate to at least
significant figures, assuming that the machine has a precision of
or more digits. For
,
should be computed with an absolute error of less than
. For further details see
G01EEF.
The time taken by G08AAF is small, and increases with .
9 Example
This example is taken from page 69 of
Siegel (1956). The data relates to ratings of ‘insight into paternal discipline’ for
sets of parents, recorded on a scale from
to
.
9.1 Program Text
Program Text (g08aafe.f90)
9.2 Program Data
Program Data (g08aafe.d)
9.3 Program Results
Program Results (g08aafe.r)