jt.test | R Documentation |
An implementation of Jonckheere's trend test for ordered independent samples.
jt.test(x, y = NULL)
x |
either a two-dimensional contingency table in matrix form or a factor object |
y |
a factor object; ignored if x is a matrix |
A list with class "htest
" containing the following elements:
statistic |
the value of the test statistic with a name describing it |
p.value |
the p-value for the test (asymptotic, two-sided, corrected for ties) |
method |
a character string describing the test used |
data.name |
a character string giving the names of the data |
Jonckheere, A. R. (1954). A distribution-free k-sample test again ordered alternatives. Biometrika 41:133-145.
Terpstra, T. J. (1952). The asymptotic normality and consistency of Kendall's test against trend, when ties are present in one ranking. Indagationes Mathematicae 14:327-333.
cor.test
; clinfin::jonckheere.test
## example from Exact Test (Mehta), figure 12.2
dat <- matrix(
c(100, 18, 50, 50, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1), 4,
dimnames = list(dose = 1:4 * 100,
toxicity = c('Mild', 'Moderate', 'Severe', 'Death'))
)
jt.test(dat)
tbl <- table(mtcars$gear, mtcars$cyl)
jt.test(tbl)
## compare
cor.test(mtcars$gear, mtcars$cyl, method = 'kendall', exact = FALSE)
# clinfun::jonckheere.test(mtcars$gear, mtcars$cyl)
## from stats::cor.test
x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y <- c(2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8)
cor.test(x, y, method = 'kendall', exact = FALSE)
jt.test(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.