Jonckheere-Terpstra Test
jonter varname [if exp] [in exp] , by(groupvar) [verbose jonly continuity]
Description
jonter calculates test statistics, J and J*, and asymptotic p-values for the Jonckheere-Terpstra test for ordered alternatives.
Options
Note that the by() is mandatory. Both varname and groupvar must be at least ordinal.
verbose allows display of the individual Mann-Whitney U counts.
jonly limits the calculations to those for the J test statistic. This allows the command to complete somewhat faster, and is highly recommended for use of jonter with permute when use is made only of the J test statistic.
continuity causes a continuity correction to be applied to J*. This might aid somewhat in the normal approximation, but use of a continuity correction with the Jonckheere-Terpstra test is not widespread.
Remarks
jonter provides an alternative to the nonparametric trend test nptrend, which is Stata's implementation of the Cuzick test. The Jonckheere-Terpstra test's p-value asymptotically converges to that for the test for Kendall's tau (ktau). As with ktau, jonter is intended for small to moderate-sized datasets; the duration of computations grows disproportionately with sample size.
jonter corrects J and J* for tied values in varname. It also reports asymptotic p-values for the test of descending ordered alternatives, as well as for that of ascending ordered alternatives. This obviates the need to manually reverse ordering of the values in the by or varname variables in order to test for a descending ordering. It also reports the asymptotic p-value for the alternative of either an ascending or a descending ordering against the null hypothesis of no ordering (i.e., the two-tailed test), when the direction of ordering in the by variable cannot be independently specified in advance.
Test statistics and p-values are returned in scalars: r(J)—Jonckheere-Terpstra test statistic, J; r(JH0)—expectation of J under the null hypothesis; r(se_JH0)—square-root of the variance of J under the null hypothesis; r(Jstar)—asymptotic normal approximation of J; and r(p), r(p_l) and r(p_u)—p-values associated with J*.
Examples
. jonter latency, by(dose)
Author
Joseph Coveney jcoveney@bigplanet.com
Acknowledgment
Nicholas J. Cox edited an earlier version of jonter, fixing bugs and providing major improvements in efficiency and functionality. Correspondence regarding support should nevertheless be addressed to the author listed above.
Also see
Manual: [R] nptrend [R] spearman