statsmodels.stats.nonparametric.jonckheere_terpstra#
- statsmodels.stats.nonparametric.jonckheere_terpstra(samples, alternative='larger')[source]#
Jonckheere-Terpstra test for ordered k-sample alternatives.
The order of samples defines the ordered alternative. Under the
"larger"alternative, later samples tend to take larger values than earlier samples. Under the"smaller"alternative, later samples tend to take smaller values.- Parameters:
- samplessequence
ofarray_like Sequence containing at least two one-dimensional samples of numeric, finite observations, in the order implied by the alternative hypothesis.
- alternative{“two-sided”, “larger”, “smaller”}
Defines the alternative hypothesis. The following options are available:
"two-sided": the ordered trend is non-zero"larger": later samples tend to have larger values"smaller": later samples tend to have smaller values
- samplessequence
- Returns:
- res
JonckheereTerpstraResult A NamedTuple with the Jonckheere-Terpstra statistic, pvalue and related quantities. The key fieleds are``statistic`` and
pvalue. SeeJonckheereTerpstraResultfor the full list of fields.
- res
See also
JonckheereTerpstraResultResults class for the Jonckheere-Terpstra test
scipy.stats.kendalltauKendall’s tau, the asymptotically equivalent trend statistic used here for the pooled observations and ordered group labels.
scipy.stats.mannwhitneyuMann-Whitney U test, the pairwise two-sample building block summed by the Jonckheere-Terpstra statistic.
scipy.stats.kruskalKruskal-Wallis H-test, a k-sample test against an unordered (omnibus) alternative rather than an ordered trend.
scipy.stats.page_trend_testPage’s L test for an ordered alternative in related (repeated-measures) samples, as opposed to the independent samples assumed here.
Notes
The Jonckheere-Terpstra statistic is the sum of pairwise Mann-Whitney type counts over all ordered pairs of groups. Ties between groups contribute one half to the raw statistic.
The p-value is computed from the asymptotic normal approximation, which is equivalent to the large-sample Kendall trend test applied to the pooled observations and their ordered group labels.
References
[1]Terpstra, T. J. “The asymptotic normality and consistency of Kendall’s test against trend, when ties are present in one ranking.” Indagationes Mathematicae 14 (1952): 327-333.
[2]Jonckheere, A. R. “A distribution-free k-sample test against ordered alternatives.” Biometrika 41 (1954): 133-145.