How this calculation works
Enter a numeric group index and observation on each row. The order expresses the proposed increasing response, not a sorting command for the data.
J=Σa<b Σi∈a Σj∈b [I(xᵢ<xⱼ)+½I(xᵢ=xⱼ)].A worked example
Ordered groups give J=27 of27 possible pairwise concordances. There are9!/(3!^3)=1680 complete labelings, so exact p=1/1680. Reverse ordering gives J0 and increasing p1.
Good to know
3–8 prespecified ordered groups, 3–40 values each, total≤120; ties receive half credit; 999–4999 seeded label permutations, fixed group sizes and 20 million comparison cap; no post-hoc chosen group ordering.
Reference: clinfun author-maintained Jonckheere reference (opens in a new tab) ↗
Specify the group order before inspecting outcomes
Enter a numeric group index and observation on each row. The order expresses the proposed increasing response, not a sorting command for the data.
Dose, duration or a declared category sequence can motivate the order. Choosing it after comparing observed means changes the test being performed.
Compare this with the Mann–Whitney U test calculator with ties. Test a prespecified increasing or decreasing stochastic ordering across independently sampled ordered groups by summing pairwise concordances across all ordered group pairs. This adds an ordered-alternative hypothesis and its own permutation null, not a larger Mann Whitney page.
Count evidence across ordered group pairs
Every observation in an earlier group is compared with every observation in a later group. Concordant pairs contribute one and ties contribute one half.
Within-group comparisons do not contribute. Larger J supports the declared increasing alternative; reversing the group order reverses the directional evidence. The default groups contain1,2,3;4,5,6; and7,8,9. Every comparison between an earlier and later group agrees with the proposed increasing direction, producing J=27. There are1,680 distinct allocations of nine labeled observations into three groups of size three, and only one achieves this maximal increasing arrangement. The exhaustive one-sided reference probability is therefore1/1680. The page uses seeded random permutations for its general input domain, so its plus-one Monte Carlo result has finite resolution and need not equal that exact reference fraction.
Retain group sizes in the null distribution
The randomization null redistributes pooled observations among groups of the original sizes. It preserves ties as distinct observations with equal numerical values.
A seeded Monte Carlo calculation samples that same allocation family. The plus-one convention includes the observed arrangement and prevents a sampled p of zero.
Work through the checked default example
Ordered groups give J=27 of27 possible pairwise concordances. There are9!/(3!^3)=1680 complete labelings, so exact p=1/1680. Reverse ordering gives J0 and increasing p1.
The three group sizes are three each. There are 1,680 distinct pooled label allocations, and just one reaches the observed maximum J=27, giving an exact increasing-tail probability of approximately 0.000595238. The ordering of groups must be part of the question before their outcomes are inspected. Sorting groups by their observed means and then running an increasing-trend test would choose an advantageous alternative after seeing the data. Numeric group identifiers communicate their prescribed order; their spacing does not weight the statistic. Codes0,1,2 and10,20,100 describe the same order if observations remain in corresponding groups. Direction also matters: reversing the codes changes an increasing question into a decreasing question. Keep the intended dose, time or severity ordering alongside the reported result.
Interpret ordering rather than all pairwise differences
A significant trend can accumulate many small ordered shifts. It does not prove that every adjacent group pair differs significantly.
The statistic is not a common slope estimate. Unequal gaps between group indices do not alter the ordinal prediction.
Respect independent sampling and exchangeability
Unrestricted group-label randomization assumes the pooled observations can exchange labels under the null. Blocking or repeated measures violates that simple design.
For a planned within-subject ordering, Page analysis ranks inside subjects instead. The independent-group and complete-block nulls answer different design questions. Tied cross-group pairs add one half, so the statistic may have a fractional value without being invalid. Permutation labels preserve the original group sizes and the observed tie structure. Independence between observations remains a separate assumption: a repeated-subject series cannot be converted into an independent-group trend merely by assigning group indices. The work limit depends on pair comparisons as well as permutation count. If that limit is reached, reduce the input or use a suitable offline implementation; lowering the random seed does not reduce the required work or improve statistical accuracy.
Distinguish this from an unordered omnibus test
An unordered omnibus test asks whether any group differs. Jonckheere-Terpstra concentrates evidence in one previously specified stochastic ordering.
Record the direction with the result. Reversing the alternative only after a disappointing p value forfeits the original one-sided interpretation. The result is invariant to a common strictly increasing transformation of all outcome values because it uses only pairwise order and ties. A transformation that changes ties through rounding can change the statistic. Report any rounding rule used on ordinal or instrument-limited measurements. Group labels themselves are not response magnitudes and must remain attached to their original sampling units throughout every permutation.
A few questions, answered
Do group indices need equal spacing?
No. They encode order only; the method does not estimate a response change per index unit.
May I sort groups by their sample means?
That would select the predicted order from the outcomes and invalidate the intended prespecified one-sided test.
Does a trend imply every pair differs?
No. J pools concordance across all ordered group pairs; it is not a family of adjusted pairwise tests.
What happens to ties?
A tied cross-group pair contributes one half and remains present in each label-randomization calculation.