Kruskal-Wallis, median and Jonckheere-Terpstra tests
Compares three or more independent groups using ranks (Kruskal-Wallis), counts above the pooled median (median test), or tests an ordered trend across groups (Jonckheere-Terpstra).
Menu: Analyze → Nonparametric Tests → Legacy Dialogs → K Independent Samples…
When should I use it?
- Satisfaction ratings across several branches.
- A dose-response question with ordered groups (Jonckheere-Terpstra).
What are the assumptions?
- Independent groups; ordinal or scale outcome.
- Jonckheere-Terpstra: the groups have a natural order (ascending codes).
How do I run it in StatLab?
- Choose outcome(s) and the grouping variable (optional code range).
- Keep 'Pairwise comparisons' ticked to see which groups differ (Dunn test, Bonferroni-adjusted).
- Choose Significance = Exact or Monte Carlo for small samples or sparse data.
How do I read the output?
| Output | Meaning |
|---|---|
| Kruskal-Wallis H, df, Asymp. Sig. | Overall test across all groups. |
| Pairwise Comparisons | Dunn tests; read 'Adj. Sig.' (Bonferroni). |
| Std. J-T Statistic | Positive = values rise with group order. |
| Exact Sig. / Point Probability | Permutation p-value using every possible arrangement of the data. |
| Monte Carlo Sig. (99% CI) | Estimated from 10,000 random arrangements (seed 2000000); the interval shows its precision. |
Worked example
On the practice survey dataset (File → Sample dataset), this command — which the dialog's Paste button also produces — runs the procedure:
PROC npKIndep /vars=(score age) /group=group /kw=YES /dunn=YES /median=NO /jt=NO /sig=asymp.
Output tables: Ranks · Test Statistics · Pairwise Comparisons of Programme group — Wellbeing score · Pairwise Comparisons of Programme group — Age (years).
How would I report it in APA style?
A Kruskal-Wallis test on Wellbeing score gave H(2) = 5.27, p = .072, ε² = .04. A Kruskal-Wallis test on Age (years) gave H(2) = 1.75, p = .416, ε² = .01.
Computed by StatLab's validated procedure code when this page was built. The example only illustrates the steps; choose variables that fit your own research question.
What are common mistakes?
- Running many Mann-Whitney tests instead of the adjusted pairwise table.
- Reading the unadjusted 'Sig.' column for pairwise decisions.
- Expecting exact results for large samples: when exact computation would take more than about 2 seconds StatLab switches to Monte Carlo and says so.