IMSL_SIGNTEST

Syntax | Return Value | Arguments | Keywords | Discussion | Examples | Version History

The IMSL_SIGNTEST function performs a sign test.

Note
This routine requires an IDL Advanced Math and Stats license. For more information, contact your ITT Visual Information Solutions sales or technical support representative.

Syntax

Result = IMSL_SIGNTEST(x [, /DOUBLE] [, N_POS_DEV=value] [, N_ZERO_DEV=value] [, PERCENTAGE=value] [, PERCENTILE=value] )

Return Value

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.

Arguments

x

One-dimensional array containing the input data.

Keywords

DOUBLE

If present and nonzero, double precision is used.

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).

PERCENTAGE

Scalar value in the range (0,1). Keyword Percentage is the 100 x Percentage percentile of the population. Default: Percentage = 0.5

PERCENTILE

Hypothesized percentile of the population from which x was drawn. Default: Percentile = 0.0

Discussion

The IMSL_SIGNTEST function 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 p-th percentile of the population from which x was obtained. To carry out testing, IMSL_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:

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.

Examples

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 = ', IMSL_SIGNTEST(x) 
 
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 = IMSL_SIGNTEST(x, Percentage = 0.75, $ 
   Percentile = 0, N_Pos_Dev  = np, N_Zero_Dev = nz) 
PM, probability, Title = 'Probability' 
PM, np, Title = 'Number of Positive Deviations' 
PM, nz, Title = 'Number of Ties' 
 
Probability 
    0.922543 
Number of Positive Deviations 
    12 
Number of Ties 
    0 

Version History

6.4

Introduced