SIGNTEST Function
Performs a sign test.
Usage
result = SIGNTEST(x)
Input Parameters
x—One-dimensional array containing the input data.
Returned Value
result—Binomial probability of N_Pos_Dev or more positive differences in N_ELEMENTS(x) – N_Zero_Dev trials. Call this value probability. If no option is chosen, the null hypothesis is that the median equals 0.0.
Input Keywords
Double—If present and nonzero, double precision is used.
Percentage—Scalar value in the range (0,1). Keyword Percentage is the 100 × Percentage percentile of the population. Default: Percentage = 0.5
Percentile—Hypothesized percentile of the population from which x was drawn. Default: Percentile = 0.0
Output Keywords
N_Pos_Dev—Number of positive differences x(j – 1) – Percentile, for
j = 1, 2, ..., N_ELEMENTS(x).
N_Zero_Dev—Number of zero differences (ties) x(j – 1) – Percentile, for
j = 1, 2, ..., N_ELEMENTS(x).
Discussion
Function SIGNTEST tests hypotheses about the proportion p of a population that lies below a value q, where p corresponds to keyword Percentage and q corresponds to keyword Percentile. In continuous distributions, this can be a test that q is the 100 pth percentile of the population from which x was obtained. To carry out testing, SIGNTEST tallies the number of values above q in N_Pos_Dev. The binomial probability of N_Pos_Dev or more values above q is then computed using the proportion p and the sample size N_ELEMENTS (x) (adjusted for the missing observations and ties).
Hypothesis testing is performed as follows for the usual null and alternative hypotheses:
*H0: Pr(X q) p (the pth quantile is at least q)
H1: Pr(X < q) < p
Reject H0 if probability is less than or equal to the significance level.
*H0: Pr(X q) p (the pth quantile is at least q)
H1: Pr(X < q) > p
Reject H0 if probability is greater than or equal to 1 minus the significance level.
*H0: Pr(X = q) = p (the pth quantile is q)
H1: Pr((X < q) < p or Pr((X < q) > p
Reject H0 if probability is less than or equal to half the significance level or greater than or equal to 1 minus half the significance level.
The assumptions are as follows:
1. The Xi’s form a random sample; i.e., they are independent and identically distributed.
2. Measurement scale is at least ordinal; i.e., an ordering less than, greater than, and equal to exists in the observations.
Many uses for the sign test are possible with various values of p and q. For example, to perform a matched sample test that the difference of the medians of Y and Z is 0.0, let p = 0.5, q = 0.0, and Xi = YiZi in matched observations Y and Z. To test that the median difference is c, let q = c.
Example 1
This example tests the hypothesis that at least 50 percent of a population is negative. Because 0.18 < 0.95, the null hypothesis at the 5-percent level of significance is not rejected.
x =[92, 139, -6, 10, 81, -11, 45, -25, -4, $
   22, 2, 41, 13, 8, 33, 45, -33, -45, -12]
PRINT, 'Probability = ', SIGNTEST(x)
; PV-WAVE prints: Probability =      0.179642
Example 2
This example tests the null hypothesis that at least 75 percent of a population is negative. Because 0.923 < 0.95, the null hypothesis at the 5-percent level of significance is rejected.
x =[92, 139, -6, 10, 81, -11, 45, -25, -4, $
   22, 2, 41, 13, 8, 33, 45, -33, -45, -12]
probability = SIGNTEST(x, Percentage = 0.75, $
   Percentile = 0, N_Pos_Dev  = np, N_Zero_Dev = nz)
PM, probability, Title = 'Probability'
; PV-WAVE prints the following:
; Probability
; 0.922543
PM, np, Title = 'Number of Positive Deviations'
; PV-WAVE prints the following:
; Number of Positive Deviations
; 12
PM, nz, Title = 'Number of Ties'
; PV-WAVE prints the following:
; Number of Ties
; 0