The routine may be called by the names g08aaf or nagf_nonpar_test_sign.
3Description
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 .
4References
Siegel S (1956) Non-parametric Statistics for the Behavioral Sciences McGraw–Hill
5Arguments
1: – Real (Kind=nag_wp) arrayInput
2: – Real (Kind=nag_wp) arrayInput
On entry: and must be set to the th pair of data values, , for .
3: – IntegerInput
On entry: , the size of each sample.
Constraint:
.
4: – IntegerOutput
On exit: the Sign test statistic, .
5: – IntegerOutput
On exit: the number of non-tied pairs, .
6: – Real (Kind=nag_wp)Output
On exit: the lower tail probability, , corresponding to .
7: – 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, .
Constraint: .
On entry, the samples are identical, i.e., .
An unexpected error has been triggered by this routine. Please
contact NAG.
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.
7Accuracy
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.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g08aaf is not threaded in any implementation.
9Further Comments
The time taken by g08aaf is small, and increases with .
10Example
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 .