SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages

Dataplot Vol 1 Vol 2


SIGN TEST

Name:
    SIGN TEST
Type:
    Analysis Command
Purpose:
    Perform a one sample or a paired two sample sign test.
Description:
    The t-test is the standard test for testing that the difference between population means for two paired samples are equal. If the populations are non-normal, particularly for small samples, then the t-test may not be valid. The sign test is an alternative that can be applied when distributional assumptions are suspect. However, it is not as powerful as the t-test when the distributional assumptions are in fact valid. It can also be applied in the case where there is no quantitative scale, but it is possible to order the data (i.e., an ordinal scale). Dataplot states the sign test in terms of medians, but it can also be expressed in terms of means.

    To form the sign test, compute di = Xi - Yi where X and Y are the two samples. Count the number of times di is positive, R+, and the number of times it is negative, R-. If the samples have equal medians and the populations are symmetric, then R+ and R- should be similar. If there are too many positives (R+) or negatives (R-), then we reject the hypothesis of equality. Ties are excluded from the analysis. Since there are only two choices (+ or -) for di the test statistic for the sign test follows a binomial distribution with p=0.5.

    Note that the binonial distribution is discrete, so the significance level will typically not be exact.

    More formally, the hypothesis test is defined as follows.

      H0: u1 = u2
      Ha: u1u2
      u1 < u2
      u1 > u2
      Test Statistic: S- = BINCDF(R-,0.5,N)
      S+ = BINCDF(R+,0.5,N)
      where BINCDF is the cumulative distribution for the binomial distribution, R- is the number of minus signs (i.e., di < 0), R+ is the number of plus signs (i.e., di > 0), and N is the sample size excluding ties between the samples.
      Significance Level: \( \alpha \) (typically set to .05). Due to the discreteness of the binomial distribution, the actual significance level will not in most cases be exact.
      Critical Region: S+ < \( \alpha \): one sided test: U1 < U2
      S- < \( \alpha \): one sided test: U1 > U2
      \( \alpha \)/2 < S+ < 1 - \( \alpha \)/2: two sided test: U1 = U2
      Conclusion: Reject the null hypothesis (or, equivalently, accept the alternative hypothesis) if the test statistic is in the critical region.

    Although the above discussion was in terms of a paired two sample test, it can easily be adapted to the following additional cases:

    1. For the one sample case that the population mean is equal to a value d0, simply compute di = xi - d0 and calculate R+ and R- based on di.

    2. For the paired two sample case where we want to test that the difference between the two population means is equal to d0, compute di = xi - yi - d0 and calculate R+ and R- based on di.
Syntax 1:
    SIGN TEST <y1> <mu>             <SUBSET/EXCEPT/FOR qualification>
    where <y1> is a response variable;
                <mu> is a number or parameter that is the hypothesized mean value;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    This syntax implements the one sample sign test.

Syntax 2:
    SIGN TEST <y1> <y2>             <SUBSET/EXCEPT/FOR qualification>
    where <y1> is the first response variable;
                <y2> is the second response variable;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    This syntax implements the two sample paired sign test where the hypothesized difference between the population means for the two samples is zero.

Syntax 3:
    SIGN TEST <y1> <y2> <mu>             <SUBSET/EXCEPT/FOR qualification>
    where <y1> is the first response variable;
                <y2> is the second response variable;
                <mu> is a number or parameter that is the hypothesized difference between the means of the two samples;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    SIGN TEST Y1 0
    SIGN TEST Y1 Y2
    SIGN TEST Y1 Y2 MU
    SIGN TEST Y1 Y2 SUBSET TAG > 2

    This syntax implements the two sample paired sign test where the hypothesized difference between the population means for the two samples is not equal to zero.

Note:
    DATAPLOT automatically prints the test statistic for both the one sided and two sided tests.
Note:
    Dataplot saves the following internal parameters after a sign test:

      STATVALP = R+, i.e., the number of plus signs
      STATVALM = R-, i.e., the number of minus signs
      STATVALP = S+, i.e., BINCDF(R+,0.5,N)
      STATVALM = S-, i.e., BINCDF(R-,0.5,N)
      CUTLOW90 = BINPPF(0.05,0.5,N)
      CUTUPP90 = BINPPF(0.95,0.5,N)
      CUTLOW95 = BINPPF(0.025,0.5,N)
      CUTUPP95 = BINPPF(0.975,0.5,N)
      CUTLOW99 = BINPPF(0.005,0.5,N)
      CUTUPP99 = BINPPF(0.995,0.5,N)
Note:
    The following statistics are also supported:

      LET A = ONE SAMPLE SIGN TEST Y
      LET A = ONE SAMPLE SIGN TEST CDF Y
      LET A = ONE SAMPLE SIGN TEST PVALUE Y
      LET A = ONE SAMPLE SIGN TEST LOWER TAIL PVALUE Y
      LET A = ONE SAMPLE SIGN TEST UPPER TAIL PVALUE Y

      LET A = TWO SAMPLE SIGN TEST Y1 Y2
      LET A = TWO SAMPLE SIGN TEST CDF Y1 Y2
      LET A = TWO SAMPLE SIGN TEST PVALUE Y1 Y2
      LET A = TWO SAMPLE SIGN TEST LOWER TAIL PVALUE Y1 Y2
      LET A = TWO SAMPLE SIGN TEST UPPER TAIL PVALUE Y1 Y2

    In addition to the above LET command, built-in statistics are supported for about 20+ different commands (enter HELP STATISTICS for details).

Default:
    None
Synonyms:
    None
Related Commands: Reference:
    Snedecor and Cochran (1989), "Statistical Methods," Eigth Edition, Iowa State University Press, pp. 138-140.
Applications:
    Confirmatory Data Analysis
Implementation Date:
    1999/5
    2000/8: bug fix for 2-sided interval. Was actually calculating a 90% interval rather than a 95% interval.
Program:
     
    SKIP 25
    READ NATR332.DAT Y1 Y2
    SET WRITE DECIMALS 4
    SIGN TEST Y1 Y2
        
    The following output was generated.
     
                 Two Sample Sign Test
                 (+ =>  Y1(i) > Y2(i), - => Y1(i) < Y2(i))
      
     First Response Variable:  Y1
     Second Response Variable: Y2
      
     H0: P(+) = P(-)
     Ha: P(+) <> P(-)
      
     Summary Statistics for Sample One:
     Number of Observations:                  10
     Sample Mean:                             140.0000
     Sample Median:                           140.5000
     Sample Standard Deviation:               3.4641
     Sample Median Absolute Deviation         2.5000
      
      
     Summary Statistics for Sample Two:
     Number of Observations:                  10
     Sample Mean:                             140.1000
     Sample Median:                           140.0000
     Sample Standard Deviation:               1.6633
     Sample Median Absolute Deviation         1.0000
      
     Test:
     Hypothesized Difference:                 0.0000
     Number of Positive Differences:          3
     Number of Negative Differences:          4
     Number of Ties:                          3
     CDF Value for Positive Values:           0.5000
     CDF Value for Negative Values:           0.7734
     P-Value (2-tailed test):                 1.0000
     P-Value (lower-tailed test):             0.5000
     P-Value (upper-tailed test):             0.7734
      
      
                 Two-Tailed Test
      
     H0: P(+) = P(-); Ha: P(+) <> P(-)
     ---------------------------------------------------------------------------
                                             Lower          Upper           Null
        Significance           Test       Critical       Critical     Hypothesis
               Level      Statistic      Value (<)      Value (>)     Conclusion
     ---------------------------------------------------------------------------
               50.0%              3              3              4         ACCEPT
               80.0%              3              2              5         ACCEPT
               90.0%              3              1              6         ACCEPT
               95.0%              3              1              6         ACCEPT
               99.0%              3              0              7         ACCEPT
               99.9%              3              0              7         ACCEPT
      
      
                 Lower One-Tailed Test
      
     H0: P(+) = P(-); Ha: P(+) < P(-)
     ------------------------------------------------------------
                                             Lower           Null
        Significance           Test       Critical     Hypothesis
               Level      Statistic      Value (<)     Conclusion
     ------------------------------------------------------------
               50.0%              3              3         REJECT
               80.0%              3              2         REJECT
               90.0%              3              2         REJECT
               95.0%              3              1         REJECT
               99.0%              3              1         REJECT
               99.9%              3              0         ACCEPT
      
      
                 Upper One-Tailed Test
      
     H0: P(+) = P(-); Ha: P(+) > P(-)
     ------------------------------------------------------------
                                             Upper           Null
        Significance           Test       Critical     Hypothesis
               Level      Statistic      Value (>)     Conclusion
     ------------------------------------------------------------
               50.0%              3              3         ACCEPT
               80.0%              3              5         ACCEPT
               90.0%              3              5         ACCEPT
               95.0%              3              6         ACCEPT
               99.0%              3              6         ACCEPT
               99.9%              3              7         ACCEPT
        
Date created: 06/05/2001
Last updated: 12/11/2023

Please email comments on this WWW page to alan.heckert@nist.gov.