VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

Why Mathematics? | Jonckheere–Terpstra, Ordered Groups and Exact Pair Counts

Three students study around open books and worksheets in a shared classroom.

Why is mathematics important when several groups are expected to follow a particular order? Because a prediction of low, middle and high contains more information than a general claim that the groups differ. The Jonckheere–Terpstra test aggregates pairwise ordering comparisons across independent groups arranged in a prespecified sequence. It turns that directional expectation into a statistic and an explicitly defined reference experiment.

Imagine independently sampled specimens assigned to three ordered conditions. We predict that higher conditions tend to produce higher measurements, while individual specimens still overlap. Counting whether an observation from a later group exceeds one from an earlier group gives a transparent route into the mechanism. The question concerns a population trend under a design, not a requirement that every observed value increase perfectly.

This guide develops a six-observation example whose exact probability can be counted completely. It also explains group order, ties, unequal sizes and the distinction from matched-block analysis. All examples are synthetic. The educational purpose is to build probability, algebra and research literacy rather than claim a real treatment effect or place the named method in a particular school syllabus.

Did You Know? Choosing the group order after viewing the outcome data spends the very information that makes an ordered test useful. An honest prior prediction can focus inference; a discovered ordering needs to be labelled exploratory or tested against genuinely new evidence.

Full chapter index

Chapters 1–4 · Understand the question
  1. Define the independent groups
  2. Preserve the predicted order
  3. Count agreement between two groups
  4. Aggregate across all ordered group pairs
Chapters 5–8 · Reproduce the example
  1. Worked example: three groups of two
  2. Count the exact fixed-size allocations
  3. See the three extreme allocations
  4. The null expectation is half the possible comparisons
Chapters 9–15 · Check assumptions
  1. Untied variance and a normal approximation
  2. A reversal should reverse the evidence
  3. Ties preserve the statistic but complicate calibration
  4. Unequal sizes change the weighting
  5. Ordered distributions are more than ordered medians
  6. A trend is not a fitted straight line
  7. Compare with Page’s matched-block test
Chapters 16–19 · Explore applications
  1. Compare with an unordered omnibus test
  2. Group order is not experimental administration order
  3. A materials-response investigation
  4. An independent educational-group exercise
Chapters 20–24 · Study and verify
  1. Learn through comparisons and counting
  2. A reproducible computation record
  3. Practice questions with checking answers
  4. Frequently asked questions
  5. Sources and next reading

CHAPTER 1 OF 24 · Understand the question

1. Define the independent groups

Back to contents

Suppose k groups contain independent observations, with sizes n₁ through n_k. Their order is meaningful before inspecting outcomes: group one is predicted to be lowest, followed by group two and so on. Group membership and measurement definitions must be recorded consistently.

The clean permutation null used here is that observations come from a common distribution and group labels are exchangeable subject to the fixed group sizes. The directional alternative concerns an increasing distributional ordering. A common-shape location model can give a central-location interpretation, but medians alone do not define every assumption behind that reference.

This is a between-group design. A different set of units appears in each group. If the same participants are observed under every condition, matching changes the experiment and a blocked or repeated-measures procedure should preserve that structure.

Neither independence nor ordering is created by putting columns in a spreadsheet. Both come from the scientific question and sampling or assignment process. State them in ordinary language before calculating anything so the eventual result has a clear referent.

Contents · Next chapter

CHAPTER 2 OF 24 · Understand the question

2. Preserve the predicted order

Back to contents

Write the group sequence and its reason in a dated analysis note. The order might follow a physical input level, a dose level, an independently established progression or another defensible mechanism. It should not be copied from the observed group medians.

If group labels are strings, software may sort them alphabetically rather than scientifically. Labels such as low, medium and high can therefore require an explicitly ordered factor or ordered list. Inspect the order actually passed to the function rather than assuming the labels speak for themselves.

A decreasing prediction can be represented by reversing the sequence or selecting the documented decreasing alternative. Make the choice before outcomes are examined. A strong reversal should count against an increasing prediction, not be rebranded as support by switching direction afterwards.

The prediction need not specify equal spacing. Ordered condition levels one, ten and one hundred still have an order, but the rank comparison does not estimate a physical slope per unit of input. That is a different modelling question.

Contents · Previous chapter · Next chapter

CHAPTER 3 OF 24 · Understand the question

3. Count agreement between two groups

Back to contents

For an earlier group a and later group b, compare every cross-group pair. Give one credit when the later-group value exceeds the earlier value, zero when it is smaller and half credit when they tie. Sum the credits to obtain J_ab.

If earlier values are [1,3] and later values are [2,4], the four credits are one, one, zero and one. The total is three out of four possible comparisons. This describes relative ordering, not the physical magnitude of the gaps.

The half-tie rule preserves symmetry: a pair’s credit in one direction plus its credit in the opposite direction equals one. It also respects ordinal measurements where ties are a genuine part of the scale rather than a defect to erase.

The comparison cells are dependent because each original observation appears in several cells. Four cells from two-plus-two observations are not four independent trials. The null reference must preserve the original group observations and sizes rather than treating every cell as a new Bernoulli experiment.

Contents · Previous chapter · Next chapter

CHAPTER 4 OF 24 · Understand the question

4. Aggregate across all ordered group pairs

Back to contents

The Jonckheere–Terpstra statistic J is the sum of J_ab over every a<b. With three groups, it combines A-versus-B, A-versus-C and B-versus-C. Later groups consistently exceeding earlier ones produce a large J.

The number of potential comparisons is M=Σ(a<b)n_a n_b. This gives an upper bound on J. Complete separation in the predicted order reaches M when there are no cross-group ties. A reversal reaches the lower end instead.

The statistic is weighted by how many observation pairs each group pairing supplies. A large pair of groups contributes more potential comparisons than a tiny pair. It is not a simple equal-weighted vote of the group medians.

Record the pairwise totals as well as J for a teaching calculation. They show how each comparison contributes and can reveal a local reversal hidden inside an otherwise large aggregate. Descriptive decomposition explains the pattern; formal pairwise follow-up still requires its own inferential plan.

Contents · Previous chapter · Next chapter

CHAPTER 5 OF 24 · Reproduce the example

5. Worked example: three groups of two

Back to contents

Use A=[1,2], B=[3,5] and C=[4,6], with A<B<C declared as the increasing expectation. There are two independent observations in each group and no ties. The example contains one reversal between the middle and final groups.

Every B value exceeds every A value, so J_AB=4. Every C value also exceeds every A value, so J_AC=4. Comparing B and C gives credits for 3<4,3<6 and 5<6, but not for 5<4; therefore J_BC=3.

The total is J=4+4+3=11. The maximum possible count is four comparisons for each of three group pairs, or M=12. The observed pattern is strongly aligned with the prediction without being perfectly separated.

The raw means and medians also rise in this constructed example, but those summaries are not how J was calculated. Keeping the pair count explicit prevents a common misunderstanding that the test simply ranks three group medians and then performs an inference on those three numbers.

PairCreditsPossible pairs
A versus B44
A versus C44
B versus C34
Total J1112
Ordered cross-group comparison credits for the six-observation example.

Contents · Previous chapter · Next chapter

CHAPTER 6 OF 24 · Reproduce the example

6. Count the exact fixed-size allocations

Back to contents

Under the untied common-distribution permutation null, pool ranks one through six and allocate two to A, two to B and two to C. The number of allocations is 6!/(2!2!2!)=90.

One way to count them is choose A’s two ranks in fifteen ways, then B’s two among the remaining four in six ways. C receives the final pair. Fifteen times six gives ninety. The allocations are equally likely under this specified exchangeability reference.

Compute J for every allocation and count those with J≥11. There are three such allocations. The increasing exact p-value is three divided by ninety, or one-thirtieth≈0.03333333.

At a prespecified five-percent threshold the example supports the increasing alternative under that reference. It remains a tiny synthetic demonstration. It does not identify a cause, quantify a slope or prove that every possible future observation will maintain the ordered pattern.

Contents · Previous chapter · Next chapter

CHAPTER 7 OF 24 · Reproduce the example

7. See the three extreme allocations

Back to contents

The perfectly ordered allocation assigns ranks [1,2] to A, [3,4] to B and [5,6] to C. Every cross-group comparison agrees, giving J=12. There is one such allocation because within-group ordering does not create another group-label allocation.

Two further allocations create just one inversion. Swapping the adjacent boundary ranks two and three gives A=[1,3], B=[2,4], C=[5,6]. Swapping four and five gives A=[1,2], B=[3,5], C=[4,6]. Each has J=11.

Any other arrangement creates at least two cross-group inversions and lowers J below eleven. Thus the upper tail contains one maximum and two near-maxima. This supplies a transparent explanation of the exact count rather than trusting only a program’s output.

Students can reconstruct the same argument by writing the group-label sequence along the pooled ranks. Count departures from the sorted sequence A,A,B,B,C,C. The exercise connects combinatorial counting with an ordering statistic and provides an independent audit of the enumeration.

Contents · Previous chapter · Next chapter

CHAPTER 8 OF 24 · Reproduce the example

8. The null expectation is half the possible comparisons

Back to contents

Under a common continuous distribution, either member of a cross-group pair is equally likely to be larger. Each pair therefore contributes expected credit one-half. By linearity of expectation, E(J)=M/2, even though the pairwise credits are dependent.

For our example M=12, so the expected J is six. An observed eleven lies far above that balance point. This describes directional alignment, while the exact allocation distribution supplies the appropriate probability calibration.

Linearity of expectation does not require independent summands. Variance does depend on their relationships, however. This distinction is an excellent lesson in probability: correctly adding expected credits does not justify treating the credits as independent trials when estimating uncertainty.

A naive binomial model with twelve independent comparisons would define the wrong reference. Reusing the six original observations creates dependence between many pair outcomes. The fixed-size permutation calculation preserves that structure automatically.

Contents · Previous chapter · Next chapter

CHAPTER 9 OF 24 · Check assumptions

9. Untied variance and a normal approximation

Back to contents

For the usual untied null, one variance expression is [N²(2N+3)−Σn_a²(2n_a+3)]/72, where N is the pooled sample size. It accounts for the structure of the cross-group comparisons rather than counting them as independent Bernoulli cells.

With N=6 and all three group sizes equal to two, the numerator is 36×15−3×4×7=456. Dividing by seventy-two gives 19/3≈6.33333333. Direct enumeration of all ninety J values reproduces this variance and expectation six.

Without a continuity correction, the standardised departure is (11−6)/√(19/3)≈1.9868. A normal upper-tail approximation is about 0.02347236, different from the exact 0.03333333. The distinction matters because a small finite distribution is not identical to a smooth limiting curve.

Use exact enumeration for this tiny teaching example. A normal approximation can be studied as a separate comparison, but it should not replace the exact result silently. Ties require further variance handling, and software implementations can differ in corrections and method-selection rules.

Contents · Previous chapter · Next chapter

CHAPTER 10 OF 24 · Check assumptions

10. A reversal should reverse the evidence

Back to contents

Reverse the group order while leaving observations unchanged. Each cross-group credit is complemented, so J_reverse=M−J when the same half-tie convention is used. For our example this becomes twelve minus eleven, or one.

The large increasing statistic has become a small one. That is exactly what should happen when a previously supported order is reversed. A test intended to assess the increasing direction must not treat both extremes as support for that same prediction.

This complement identity is a useful implementation check. It remains valid with half-credit ties because each pair’s directional credits sum to one. It does not require replacing the outcomes with numerical negatives, which could introduce other changes.

A two-sided ordering analysis uses a separately defined reference for departures in either direction. Do not assume its p-value can be reconstructed by an arbitrary doubling rule without checking the implementation. Report the alternative actually analysed, especially when a directional scientific expectation motivated the study.

Contents · Previous chapter · Next chapter

CHAPTER 11 OF 24 · Check assumptions

11. Ties preserve the statistic but complicate calibration

Back to contents

Half credit gives a transparent statistic when observations tie. If the earlier and later values both equal five, the pair contributes one-half rather than inventing an order. Many rubric scales and count outcomes naturally produce ties.

The untied exact distribution and variance formula should not be applied uncritically to a tied dataset. Different maintained implementations offer tie-corrected approximations, conditional permutation enumeration or simulation. Their accepted inputs and automatic choices need to be checked explicitly.

DescTools documentation describes an untied exact procedure with size limits and exposes permutation options, while kSamples documents exact and simulated fixed-size splitting with its own limits. These are implementation contracts, not universal statements that every package handles ties identically.

Do not add random noise to obtain a convenient untied result. It changes observed equalities into arbitrary wins and losses. Preserve the scale, state the tie pattern and choose a calibration justified by the actual sampling or assignment model.

Contents · Previous chapter · Next chapter

CHAPTER 12 OF 24 · Check assumptions

12. Unequal sizes change the weighting

Back to contents

Suppose A has two observations, B twenty and C two. A-versus-B and B-versus-C each supply forty pairs, while A-versus-C supplies four. The middle group participates in many comparisons because it is large.

That weighting follows the statistic’s construction. It does not mean B is more scientifically important or that the two small groups are well estimated. Sample allocation should reflect the question, variability, recruitment costs and required precision.

An extreme imbalance can make some local contrasts difficult to assess even when J is large overall. Keep group sizes and pairwise totals visible. A global statistic should not conceal how little information comes from a particular group.

For a simulation project, vary both sizes and generating distributions. Balanced examples are easy to teach but do not cover every design. A method’s allowance for unequal samples is not a guarantee of ideal performance under every allocation and tie structure.

Contents · Previous chapter · Next chapter

CHAPTER 13 OF 24 · Check assumptions

13. Ordered distributions are more than ordered medians

Back to contents

Medians can rise while other parts of the distributions cross in complicated ways. A simple stochastic-order interpretation says later distributions tend to place more probability on larger outcomes, not merely that three observed middle values are sorted.

Under an appropriate common-shape location model, a shift in central location can support a simpler ordered-location interpretation. Outside that model, state the distributional question and inspect empirical distributions rather than claiming the test proves a universal order of medians.

No statistic requires every observation in a later group to exceed every earlier one. Overlap is compatible with a meaningful population ordering. The pairwise mechanism measures aggregate agreement while recognising that random individual comparisons can reverse.

Plot the data and retain raw-unit summaries. A global ordered statistic cannot reveal whether one group has an undesirable tail, a different spread or a subgroup mixture. Those features may matter to the practical decision even when the directional comparison is statistically persuasive.

Contents · Previous chapter · Next chapter

CHAPTER 14 OF 24 · Check assumptions

14. A trend is not a fitted straight line

Back to contents

The test uses the group sequence, not numerical distances between condition levels. Increasing inputs one, ten and one hundred are treated as ordered groups without making their gaps enter as ninety and nine in the pairwise formula.

Consequently J does not estimate a slope, a rate of change or equal increments. A pattern with a large final jump and a tiny first jump can produce the same ordering statistic as evenly spaced changes, provided the cross-group orderings remain the same.

Use regression or another response model when the scientific target concerns a curve or change per unit of input. That model adds its own assumptions, but it directly represents information the rank-order statistic discards.

The distinction is constructive. An ordered test is useful when the order is defensible while metric spacing is uncertain or irrelevant. It becomes misleading when its conclusion is translated into a quantitative dose-response claim that no slope calculation was performed to support.

Contents · Previous chapter · Next chapter

CHAPTER 15 OF 24 · Check assumptions

15. Compare with Page’s matched-block test

Back to contents

Page’s trend test ranks conditions within matched blocks. The same unit appears under all conditions, and within-block ranking preserves that matching. Jonckheere–Terpstra instead compares independently sampled groups through cross-group pairs.

Both methods use a prespecified order, but their evidence structures and reference spaces differ. In Page’s small example, rank permutations occur within each block. Here labels are allocated across a pooled set subject to independent-group sizes.

Do not select between them by whichever p-value is smaller on a reshaped spreadsheet. Ask whether each observation belongs to a distinct independently sampled unit or to a unit repeatedly observed under several conditions. The design determines the appropriate analysis family.

This contrast is especially useful for students. “Three conditions” sounds like one problem in everyday language, yet the same people under all three and different people under each condition are different mathematical experiments. Preserving the relationship between measurements is part of reasoning correctly.

Contents · Previous chapter · Next chapter

CHAPTER 16 OF 24 · Explore applications

16. Compare with an unordered omnibus test

Back to contents

A general independent-group rank comparison asks whether groups differ without concentrating on one prior sequence. Jonckheere–Terpstra uses the ordered alternative to focus the evidence. A U-shaped pattern may contradict the increasing story while still showing substantial group differences.

For example, a high middle group between two low groups is not well described by A<B<C. An ordered test need not be sensitive to that pattern in the same way as an unordered omnibus method. The procedure is answering the prediction it was given.

Conversely, a consistent modest progression can benefit from the justified prior order. That is the value of scientific structure: the analysis is not searching every possible pattern equally. The order must be honest and established before the confirmatory data are examined.

If both ordered and unordered questions matter, specify them in the plan and address multiplicity. Do not run a collection of alternatives and present only the most significant as though it were the sole original hypothesis.

Contents · Previous chapter · Next chapter

CHAPTER 17 OF 24 · Explore applications

17. Group order is not experimental administration order

Back to contents

The predicted sequence concerns outcome levels across conditions. It does not automatically prescribe which condition should be administered first. When measurements are taken over time, practice, fatigue, seasonality or changing equipment conditions can confound the group comparison.

Random assignment and appropriate control of administration can help when the experimental context permits them. In observational studies, adjustment or a more detailed model may be necessary, and causal claims may remain limited.

If all low-condition specimens are measured on one day and all high-condition specimens on another, a day effect can imitate a trend. The ordered rank statistic cannot distinguish those explanations from the outcome values alone.

Write a separate record of condition level, measurement date, unit and assignment process. This makes competing explanations visible before inference. A meaningful mathematical prediction needs a design that gives its observed alignment a defensible interpretation.

Contents · Previous chapter · Next chapter

CHAPTER 18 OF 24 · Explore applications

18. A materials-response investigation

Back to contents

Generate independent synthetic measurements at three ordered input levels. Begin with a common distribution under the null, then create a location-shift alternative with overlap. Calculate pairwise credits and J for a small selected dataset before automating many runs.

Plot group distributions and inspect whether the chosen alternative represents a genuine ordered pattern. Change spread in one group and observe how that affects interpretation. A rising central feature can coexist with crossing tails.

Compare exact enumeration where feasible with simulation of fixed-size label allocations. Preserve the generating seed, group order and tail direction. Simulation error should be reported if only a finite random subset of allocations is examined.

End with a domain criterion: what response difference would matter to material performance? Ordered statistical evidence alone does not establish adequate strength, safety or manufacturing tolerance. The practical requirement supplies a standard the rank statistic does not contain.

Contents · Previous chapter · Next chapter

CHAPTER 19 OF 24 · Explore applications

19. An independent educational-group exercise

Back to contents

Use synthetic results for three independent groups with a prior ordered condition such as a specified amount of practice in a hypothetical experiment. Keep task difficulty, scoring and outcome definitions identical so the example does not hide a measurement mismatch.

Actual educational data bring selection and clustering. More practice may be associated with prior motivation, resources or existing ability. A statistically supported ordering is not automatically evidence that practice alone caused the observed difference.

Avoid attaching ability labels to learners. Group distributions overlap and individual development can be uneven. A population ordering cannot diagnose which concept a particular pupil needs to repair or guarantee that one learner follows the group pattern.

For parents and educators, the useful lesson is disciplined interpretation. Ask what was predicted, how units were assigned and what the observations measure. Then return to the child’s work and independent explanations when deciding the next learning step.

Contents · Previous chapter · Next chapter

CHAPTER 20 OF 24 · Study and verify

20. Learn through comparisons and counting

Back to contents

Start with inequalities and half-credit ties. Build a small cross-group grid and predict which cells count as agreement. This makes the statistic accessible through familiar arithmetic before introducing the unfamiliar surname.

Next connect all group pairs and calculate M. Explain why each observation is reused and why comparison cells are not independent trials. Use linearity of expectation to find M/2 without assuming independence.

Move to binomial coefficients and multinomial allocations. Count the ninety possible assignments for group sizes two,two,two, then inspect the three upper-tail cases. The exact probability becomes an exercise in finite combinatorics rather than a mysterious software judgement.

Finally examine invariance, ties and failure cases. A strong learner can explain not just how to calculate J, but why an order chosen afterwards changes the claim and why a matched design requires another reference.

Contents · Previous chapter · Next chapter

CHAPTER 21 OF 24 · Study and verify

21. A reproducible computation record

Back to contents

Save original observations, group labels, scientific order and the reason for that order. Record sample sizes, ties, missingness and exclusions. Keep the direction, method and software version or custom enumeration code together with the result.

For an educational implementation, compare two independent calculations: a direct pairwise grid and a count based on the pooled group-label sequence. Reproduce the expected value and variance of the complete small reference, not just the observed statistic.

Use fixed-size label allocations only when exchangeability under the null is justified. A cluster, paired or constrained randomisation design may require a different permutation space. Randomly shuffling every row is not a universally valid inference method.

Distinguish complete enumeration from simulated permutation sampling. If simulation is used, retain the seed, number of draws and appropriate Monte Carlo uncertainty. More simulated draws reduce numerical noise; they do not repair an inappropriate reference experiment.

Contents · Previous chapter · Next chapter

CHAPTER 22 OF 24 · Study and verify

22. Practice questions with checking answers

Back to contents

Question 1: Earlier values [1,3] and later values [2,4] give three ordering credits. List the four comparisons to verify which one is a reversal.

Question 2: For three group sizes two,two,two, M=4+4+4=12 and E(J)=6 under the untied common-distribution null. Twelve cells do not mean twelve independent observations.

Question 3: Reversing the group order in the worked example gives J_reverse=12−11=1. The large increasing result becomes a small increasing statistic under the reversed prediction.

Question 4: How many allocations exist? Choose two of six ranks for A and two of the remaining four for B: fifteen times six equals ninety. C receives the rest.

Question 5: Does adding one hundred to every observation change J? No, all comparisons remain the same. Rounding can change J because distinct observations may become ties.

Contents · Previous chapter · Next chapter

CHAPTER 23 OF 24 · Study and verify

23. Frequently asked questions

Back to contents

Does this compare the same people repeatedly?

The standard independent-group version does not preserve repeated-person matching. A matched-block or repeated-measures analysis should reflect that design. Choose from the observation relationships rather than the number of columns.

Must every group be perfectly separated?

No. The statistic aggregates pairwise agreement and allows overlap and reversals. The worked example has one reversal but produces a large directional statistic under its exact reference.

Does it estimate how much larger the outcome becomes?

No. It uses ordering and half ties, not the physical sizes of gaps or input spacing. Report raw-unit contrasts separately, and use a response model when slope or magnitude is the main target.

Can I order groups by their observed medians?

That creates an exploratory ordering rather than the claimed prior alternative. Record the discovery honestly and use new evidence or an analysis that accounts for searching when confirmation is intended.

What is the broad mathematical lesson?

A prior order is useful information, but only when preserved honestly. Pair counting, combinatorial reference spaces and design-aware interpretation show how mathematics connects prediction with evidence while keeping the conclusion limited.

Contents · Previous chapter · Next chapter

CHAPTER 24 OF 24 · Study and verify

24. Sources and next reading

Back to contents

The foundational work includes Jonckheere’s 1954 A Distribution-Free k-Sample Test Against Ordered Alternatives. The maintained DescTools documentation specifies the pair statistic and implementation options; kSamples documentation explains fixed-size exact and simulated allocations. The six-observation reference here was independently enumerated in full.

For the matched contrast, read Page’s trend test. For the independent unordered comparison, continue with Kruskal–Wallis. The Mathematics Learning Hub connects these methods with inequalities, probability and clear explanation.

Contents · Previous chapter · Mathematics Learning Hub

Discover more from eduKate Singapore

Subscribe now to keep reading and get access to the full archive.

Continue reading