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 2 Vol 1

JONCKHEERE TERPSTRA

Name:
    JONCKHEERE TERPSTRA
Type:
    Analysis Command
Purpose:
    Perform a Jonckheere Terpstra test that k samples come from identical populations.
Description:
    Analysis of Variance (ANOVA) is a data analysis technique for examining the significance of the factors (= independent variables) in a multi-factor model. The one factor model can be thought of as a generalization of the two sample t-test. That is, the two sample t-test is a test of the hypothesis that two population means are equal. The one factor ANOVA tests the hypothesis that k population means are equal.

    The Kruskal-Wallis test is a nonparametric alternative to the one factor ANOVA. The Jonckheere Terpstra test is another nonparametric alernative. The distinction is that the Jonckheere-Terpstra test alternative is used when there is an expected rank order of the factor level effects. That is, given that there are k levels for the factor it tests the hypothesis

      \( H_{0} = F_{1}(x) = F_{2}(x) = \ldots = F_{k}(x) \)
      \( H_{a} = F_{1}(x) \ge F_{2}(x) \ge \ldots \ge F_{k}(x) \)

    Given k samples \( X_1, X_2, \dots , X_k \) of size \( n_1, n_2, \ldots , n_k \), the Jonckheere-Terpa test statistic is defined as

      \( S = \sum_{i = 1}^{k-1}{\sum_{j=i+1}^{k}{p_{ij}}} - \sum_{i = 1}^{k-1}{\sum_{j=i+1}^{k}{n_{i} n_{j}}} \)

    where \( p_{ij} \) is sum of the number of times \( X_i < X_j \).

    Dataplot computes the critical values for this test in two ways.

    1. The first method uses a permutation test (see Higgins). That is, the response values are permuted NITER times and the test statistic is computed for each permutation. This forms the reference distribution The p-value is based on the number of permutations that have Jonckheere-Terpstra value greater than value computed from the original data.

    2. The second method is a large sample normal approximation. Compute the adjusted statistic

        \( S_{adj} = \frac{S} {\sqrt{ \frac{1}{18}(n^{2}(2n + 3) - \sum_{i=1}^{k}{n_{i}^2(2n_{i} + 3)} }} \)

      This adjusted statistic is compared to a standard normal distribution. The p-value is then \( 1 - \phi^{-1}(S_{adj}) \) where \( \phi^{-1} \) is the cumulative distribution function of the standard normal distribution.

    The Jonckheere-Terpstra test is an upper tailed test.

Syntax:
    JONCKHEERE TERPSTRA <y> <x>
                            <SUBSET/EXCEPT/FOR qualification>
    where <y> is the response (= dependent) variable;
                <x> is the factor (= independent) variable;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    JONCKHEERE TERPSTRA Y X
    JONCKHEERE TERPSTRA Y X SUBSET X = 1 TO 4
Note:
    The group-id variable should be coded from the smallest to largest anticpated ordering.

    The data does not need to be pre-sorted either within level or between levels.

Note:
    By default, Dataplot generates 4,000 permutations. To change this, enter the command

      SET PERMUTATION TEST SAMPLE SIZE <value>

    If <value> is less than 100, it will be set to 100. If <value> is greater than 100,000, it will be set to 100,000.

    Permutation tests assume the observations are independent. However, no distributional assumptions are made about the response variable.

Note:
    This routine uses a random permutation algorithm suggested by Knuth. Specifically, it adapts the RANDPERM routine of Knoble.
Note:
    The following parameters are saved after the k sample permutation test is performed.

      STATVAL - value of the test statistic
      STATCDF - CDF of the test statistic
      PVALUE - p-value of the test statistic
      P80 - 80% upper critical value
      P90 - 90% upper critical value
      P95 - 95% upper critical value
      P975 - 97.5% upper critical value
      P99 - 99% upper critical value
      P995 - 99.5% upper critical value
      P999 - 99.9% upper critical value
      P20 - 20% upper critical value
      P10 - 10% upper critical value
      P05 - 5% upper critical value
      P025 - 2.5% upper critical value
      P01 - 1% upper critical value
      P005 - 0.5% upper critical value
      P001 - 0.1% upper critical value
Note:
    The computed values of the statistic for each permutation are written to the file dpst1f.dat. The use of this file is demonstrated in the program examples below.

    The full permutations are written to the file dpst2f.dat.

Default:
    None
Synonyms:
    JONCKHEERE TERPSTRA TEST
Related Commands: Reference:
    Jonckheere (1954), "Distribution-Free k-Sample Test Against Ordered Alternatives," Biometrika, Vol. 41, No. 1/2, pp. 133-145.

    Higgins (2004), "Introduction to Modern Nonparameteric Statistics," Duxbury Press, chapter 3, p. 101.

    Knuth (1998), "The Art of Computer Programming: Volume 2 Seminumerical Algorithms, Third Edition", Section 3.4.2, Addison-Wesley.

    Knoble RANDPERM algorithm downloaded from: "http://coding.derkeiler.com/Archive/Fortran/comp.lang.fortran/ 2006-03/msg00748.html"

Applications:
    One Factor Analysis
Implementation Date:
    2024/03
Program 1:
     
    set random number generator fibbonacci congruential
    seed 26101
    .
    .           Read the data
    .
    read jonck.dat x y
    .
    .           Perform the Jonckheere-Terpstra test
    .
    jonckheere terpstra test y x
    
    The following output is generated
                 Jonckheere-Terpstra Permutation Test
                 (Critical Values Determined from Permutation Test)
      
     Response Variable:  Y
     Group-ID Variable:  X
      
     H0: F1(x) = F2(x) = ... = Fk(x)
     Ha: F1(x) >= F2(x) >= ... >= Fk(x)
      
     Test:
     Number of Permutation Samples:                     4000
     Statistic Value:                                46.0000
     Test CDF Value:                                  0.9885
     Test P-Value:                                    0.0115
      
      
                 Conclusions (Upper 1-Tailed Test)
      
     ------------------------------------------------------------
                                                             Null
        Significance           Test       Critical     Hypothesis
               Level      Statistic    Region (>=)     Conclusion
     ------------------------------------------------------------
               80.0%        46.0000        18.0000         REJECT
               90.0%        46.0000        28.0000         REJECT
               95.0%        46.0000        34.0000         REJECT
               99.0%        46.0000        48.0000         ACCEPT
      
      
                 Jonckheere-Terpstra Test
                 (Critical Values Determined from Normal Approximation)
      
     Response Variable:  Y
     Group-ID Variable:  X
      
     H0: F1(x) = F2(x) = ... = Fk(x)
     Ha: F1(x) >= F2(x) >= ... >= Fk(x)
      
     Test:
     Number of Permutation Samples:                     4000
     Statistic Value:                                46.0000
     Adjusted Statistic Value:                        2.1479
     Test CDF Value:                                  0.9841
     Test P-Value:                                    0.0159
      
      
                 Conclusions (Upper 1-Tailed Test)
      
     ------------------------------------------------------------
                                                             Null
        Significance  Adjusted Test       Critical     Hypothesis
               Level      Statistic    Region (>=)     Conclusion
     ------------------------------------------------------------
               80.0%         2.1479         0.8416         REJECT
               90.0%         2.1479         1.2816         REJECT
               95.0%         2.1479         1.6449         REJECT
               99.0%         2.1479         2.3263         ACCEPT
    
    .
    .           Plot the results
    .
    title offset 7
    title case asis
    label case asis
    y1label Count
    x1label Jonckheere-Terpstra Permutations
     
    let statval = round(statval,3)
    let p95  = round(p95,3)
    let pval = round(pvalue,3)
    let statcdf = round(statcdf,3)
    .
    x2label color red
    x2label JT of Original Sample: ^statval
    x3label color blue
    x3label 95 Percentile: ^P95
    . xlimits -1.0 1.0
    let niter = 4000
    skip 1
    read dpst1f.dat z
    title Histogram of Jonckheere-Terpstra Test for ^niter Permutationscr() ...
          (Pvalue: ^pval, CDF: ^statcdf)
    .
    histogram z
    .
    line color red
    line dash
    drawdsds statval 20 statval 90
    line color blue
    line dash
    drawdsds p95 20 p95 90
        
Program 2:
     
    set random number generator fibbonacci congruential
    seed 391631
    .
    .           Read the data
    .
    skip 25
    read con326.dat y x
    .
    .           Perform the Jonckheere-Terpstra test
    .
    jonckheere terpstra test y x
    
                 Jonckheere-Terpstra Permutation Test
                 (Critical Values Determined from Permutation Test)
      
     Response Variable:  Y
     Group-ID Variable:  X
      
     H0: F1(x) = F2(x) = ... = Fk(x)
     Ha: F1(x) >= F2(x) >= ... >= Fk(x)
      
     Test:
     Number of Permutation Samples:                     4000
     Statistic Value:                               204.0000
     Test CDF Value:                                  0.9993
     Test P-Value:                                    0.0008
      
      
                 Conclusions (Upper 1-Tailed Test)
      
     ------------------------------------------------------------
                                                             Null
        Significance           Test       Critical     Hypothesis
               Level      Statistic    Region (>=)     Conclusion
     ------------------------------------------------------------
               80.0%       204.0000        56.0000         REJECT
               90.0%       204.0000        82.0000         REJECT
               95.0%       204.0000       106.0000         REJECT
               99.0%       204.0000       148.0000         REJECT
      
      
                 Jonckheere-Terpstra Test
                 (Critical Values Determined from Normal Approximation)
      
     Response Variable:  Y
     Group-ID Variable:  X
      
     H0: F1(x) = F2(x) = ... = Fk(x)
     Ha: F1(x) >= F2(x) >= ... >= Fk(x)
      
     Test:
     Number of Permutation Samples:                     4000
     Statistic Value:                               204.0000
     Adjusted Statistic Value:                        3.4004
     Test CDF Value:                                  0.9997
     Test P-Value:                                    0.0003
      
      
                 Conclusions (Upper 1-Tailed Test)
      
     ------------------------------------------------------------
                                                             Null
        Significance  Adjusted Test       Critical     Hypothesis
               Level      Statistic    Region (>=)     Conclusion
     ------------------------------------------------------------
               80.0%         3.4004         0.8416         REJECT
               90.0%         3.4004         1.2816         REJECT
               95.0%         3.4004         1.6449         REJECT
               99.0%         3.4004         2.3263         REJECT
    
    .
    .           Plot the results
    .
    title offset 7
    title case asis
    label case asis
    y1label Count
    x1label Jonckheere-Terpstra Permutations
    let statval = round(statval,3)
    let p95 = round(p95,3)
    let pval = round(pvalue,3)
    let statcdf = round(statcdf,3)
    .
    x2label color red
    x2label JT of Original Sample: ^statval
    x3label color blue
    x3label 95 Percentile: ^P95
    let niter = 4000
    skip 1
    read dpst1f.dat z
    title Histogram of Jonckheere-Terpstra Test for ^niter Permutationscr() ...
          (Pvalue: ^pval, CDF: ^statcdf)
    .
    histogram z
    .
    line color red
    line dash
    drawdsds statval 20 statval 90
    line color blue
    line dash
    drawdsds p95 20 p95 90
        
Date created: 03/08/2024
Last updated: 03/08/2024

Please email comments on this WWW page to [email protected].