The Jonckheere-Terpstra k-sample test statistic JT is defined as \(JT = \sum_{i<j} W_{ij}\) where \(W_{ij}\) is the Mann-Whitney statistic comparing samples \(i\) and \(j\), indexed in the order of the stipulated increasing alternative. It is assumed that there are no ties in the pooled samples.
This function uses Harding's algorithm as far as computations are possible without becoming unstable.
djt(x, nn)pjt(x, nn)
qjt(p, nn)
For djt
it is a vector
\(p = (p_1,\ldots,p_n)\)
giving the values of
\(p_i = P(JT = x_i)\), where n
is the length
of the input x
.
For pjt
it is a vector
\(P = (P_1,\ldots,P_n)\)
giving the values of \(P_i = P(JT \leq x_i)\).
For qjt
is a vecto r \(x = (x_1,\ldots,x_n)\),where \(x_i\)
is the smallest \(x\)
such that \(P(JT \leq x) \geq p_i\).
a numeric vector, typically integers
a vector of integers, representing the sample sizes in the order stipulated by the alternative
a vector of probabilities
While Harding's algorithm is mathematically correct, it is problematic in its computing implementation. The counts become very large and normalizing them by combinatorials leads to significance loss. When that happens the functions return an error message: can't compute due to numerical instability. This tends to happen when the total number of sample values becomes too large. That depends also on the way the sample sizes are allocated.
Harding, E.F. (1984), An Efficient, Minimal-storage Procedure for Calculating the Mann-Whitney U, Generalized U and Similar Distributions, Appl. Statist. 33 No. 1, 1-6.
Jonckheere, A.R. (1954), A Distribution Free k-sample Test against Ordered Alternatives, Biometrika, 41, 133-145.
Lehmann, E.L. (2006), Nonparametrics, Statistical Methods Based on Ranks, Revised First Edition, Springer Verlag.
Terpstra, T.J. (1952), The Asymptotic Normality and Consistency of Kendall's Test against Trend, when Ties are Present in One Ranking, Indagationes Math. 14, 327-333.
djt(c(-1.5,1.2,3), 2:4)
pjt(c(2,3.4,7), 3:5)
qjt(c(0,.2,.5), 2:4)
Run the code above in your browser using DataLab