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

COX STUART TEST

Name:
    COX STUART TEST
Type:
    Analysis Command
Purpose:
    Perform a Cox-Stuart test for trend for a univariate data set.
Description:
    In many measurement processes, it is desirable to detect the prescence of trend (e.g., due to drift). That is, if the data are assumed to be independent observations, we are interested in knowing if there is in fact a time dependent trend (i.e., the observations are in fact not independent).

    Given a set of ordered observations X1, X2, ..., Xn, let

       
      c = n/2       if n even
        = (n+1)/2   if n odd
          

    Then pair the data as X1,X1+c, X2,X2+c, ..., Xn-c,Xn. The Cox-Stuart test is then simply a sign test applied to these paired data.

Syntax 1:
    <LOWER TAILED/UPPER TAILED> COX STUART TEST <y>
                            <SUBSET/EXCEPT/FOR qualification>
    where <LOWER TAILED/UPPER TAILED> is an optional keyword that specifies either a lower tailed or an upper tailed test;
                <y> is a response variable;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    If neither LOWER TAILED or UPPER TAILED is specified, the Cox and Stuart test will return the results for the two-tailed case, the lower tailed case, and the upper tailed case. If LOWER TAILED is specified, then only the results for the lower tailed case will be printed. If UPPER TAILED is specified, then only the results for the upper tailed case will be printed.

Syntax 2:
    <LOWER TAILED/UPPER TAILED> COX STUART TEST <y1> ... <yk>
                            <SUBSET/EXCEPT/FOR qualification>
    where <LOWER TAILED/UPPER TAILED> is an optional keyword that specifies either a lower tailed or an upper tailed test;
                <y1> ... <yk> is a list of 1 to 30 response variables;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    This syntax will perform a Cox-Stuart test for each of the response variables. For example,

      COX STUART TEST Y1 TO Y4

    is equivalent to

      COX STUART TEST Y1
      COX STUART TEST Y2
      COX STUART TEST Y3
      COX STUART TEST Y4
Examples:
    COX STUART TEST Y
    COX STUART TEST Y1 Y2 Y3
    COX STUART TEST Y1 TO Y5
    LOWER TAILED COX STUART TEST Y
    UPPER TAILED COX STUART TEST Y
Note:
    The COX STUART TEST will accept matrix arguments. If a matrix is given, the data elements in the matrix will be collected in column order to form a vector before performing the Cox-Stuart test.
Note:
    Dataplot saves the following internal parameters after a Cox and Stuart test:

      STATVAL: the value of the test statistic
      STATCDF: the CDF of the test statistic
      PVALUE: the p-value for the two-sided test
      PVALUELT: the p-value for the lower tailed test
      PVALUEUT: the p-value for the upper tailed test
      CUTLOW50: the 50% lower tailed critical value
      CUTUPP50: the 50% upper tailed critical value
      CUTLOW80: the 80% lower tailed critical value
      CUTUPP80: the 80% upper tailed critical value
      CUTLOW90: the 90% lower tailed critical value
      CUTUPP90: the 90% upper tailed critical value
      CUTLOW95: the 95% lower tailed critical value
      CUTUPP95: the 95% upper tailed critical value
      CUTLOW99: the 99% lower tailed critical value
      CUTUPP99: the 99% upper tailed critical value
      CUTLO999: the 99.9% lower tailed critical value
      CUTUP999: the 99.9% upper tailed critical value
Note:
    The run sequence plot can be used to graphically assess whether or not there is trend in the data. The 4-plot can be used to assess the more general assumption of "independent, identically distributed" data.

    The paired data can also be analyzed using other techniques for comparing two response variables (e.g., t-test, bihistogram, quantile-quantile plot).

Default:
    None
Synonyms:
    None
Related Commands: Reference:
    Conover (1999), "Practical Nonparametric Statistics", Third Edition, Wiley, pp. 170-175.
Applications:
    Confirmatory Data Analysis
Implementation Date:
    2011/6
Program:
     
    . Purpose: Test the Cox Stuart Trend Test
    .          Sample data from example 2 on page 171 of Conover.
    .
    let y = data  45.25 45.83 41.77 36.26 45.37 52.25 35.37 57.16 35.37 ...
                  58.32 41.05 33.72 45.73 37.90 41.72 36.07 49.83 36.24 ...
                  39.90
    .
    set write decimals 4
    cox stuart test y
        
    The following output is generated.
                Cox Stuart Test for Trend
                (Compare Observations < Midpoint to Those > Midpoint)
     
    Response Variable:  Y
     
    H0: There is No Trend
    Ha: There is a Trend
     
    Summary Statistics:
    Number of Observations                                    19
    Number of Observations After Matching:                     9
     
    Summary Statistics for Points Below Midpoint:
    Sample Mean:                                         43.8477
    Sample Median:                                       45.2500
    Sample Standard Deviation:                            7.5965
    Sample Median Absolute Deviation                      7.0000
     
     
    Summary Statistics for Points Above Midpoint:
    Sample Mean:                                         40.2399
    Sample Median:                                       39.8999
    Sample Standard Deviation:                            5.0799
    Sample Median Absolute Deviation                      3.6599
     
    Test:
    Number of Positive Differences:                            5
    Number of Negative Differences:                            4
    Number of Ties:                                            0
    CDF Value for Positive Values:                        0.7460
    CDF Value for Negative Values:                        0.5000
    P-Value (2-tailed test):                              1.0000
    P-Value (lower-tailed test):                          0.7460
    P-Value (upper-tailed test):                          0.5000
     
     
                Two-Tailed Test
     
    H0: P(+) = P(-); Ha: P(+) <> P(-)
    ---------------------------------------------------------------------------
                                            Lower          Upper           Null
       Significance           Test       Critical       Critical     Hypothesis
              Level      Statistic      Value (<)      Value (>)     Conclusion
    ---------------------------------------------------------------------------
              50.0%              5              3              6         ACCEPT
              80.0%              5              3              6         ACCEPT
              90.0%              5              2              7         ACCEPT
              95.0%              5              2              7         ACCEPT
              99.0%              5              1              8         ACCEPT
              99.9%              5              0              9         ACCEPT
        
Date created: 09/22/2011
Last updated: 12/11/2023

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