Is it possible to implement the Jonckheere-Terpstra test for ordered alternatives using the coin package: Conditional Inference Procedures in a Permutation Test Framework? I found jonckheere.test{clinfun}, but it uses a normal approximation when ties are present in the data. To make this concrete, I've include a small dataset. Thanks. --Dale Hollander and Wolfe, 1999 Table 6.6, pg 205 control <- c(40, 35, 38, 43, 44, 41) rough <- c(38, 40, 47, 44, 40, 42) accurate <- c(48, 40, 45, 43, 46, 44) pieces <- list(control, rough, accurate) n <- c(6, 6, 6) grp <- as.ordered(factor(rep(1:length(n),n))) library(clinfun) jonckheere.test(unlist(pieces), grp, alternative="increasing") Output below ...> jonckheere.test(unlist(pieces), grp, alternative="increasing")Jonckheere-Terpstra test data: JT = 79, p-value = 0.02163 alternative hypothesis: increasing Warning message: In jonckheere.test(unlist(pieces), grp, alternative = "increasing") : TIES: p-value based on normal approximation
I am unfamiliar with how to use coin, but it looks like it should be doable - the vignette in coin.pdf does a Page test. The wikipedia page for Page's test explains how this is related to the Jonckheere-Terpstra test, which seems to suggest if it can do one it should be able to do the other. Add to that the fact that coin can do the unordered version of the J-T (which is just Kruskal-Wallis) and again, it seems like it should be able to do it. -- View this message in context: http://r.789695.n4.nabble.com/Jonckheere-Terpstra-test-using-coin-package-tp2019893p2020340.html Sent from the R help mailing list archive at Nabble.com.
Using coin ... answer provided by Prof. Hothorn. control <- c(40, 35, 38, 43, 44, 41) rough <- c(38, 40, 47, 44, 40, 42) accurate <- c(48, 40, 45, 43, 46, 44) pieces <- list(control, rough, accurate) n <- c(6, 6, 6) grp <- as.ordered(factor(rep(1:length(n),n))) library("coin") library("multcomp") (y <- unlist(pieces)) k <- length(pieces) (x <- as.ordered(factor(rep(1:k,n)))) ### look at K. The second line just sums up. ff <- function(x) { K <- contrMat(table(x), "Tukey")[,x] as.vector(rep(1, nrow(K)) %*%K) } independence_test(y ~ x, ytrafo = rank, xtrafo = function(data) trafo(data, factor_trafo = ff), alternative="greater", distribution="asymptotic") independence_test(y ~ x, ytrafo = rank, xtrafo = function(data) trafo(data, factor_trafo = ff), alternative="greater", distribution=approximate(B=500000)) On Wed, Apr 21, 2010 at 8:23 PM, Dale Steele <dale.w.steele at gmail.com> wrote:> Is it possible to implement the Jonckheere-Terpstra test for ordered > alternatives using the coin package: Conditional Inference Procedures > in a Permutation Test Framework? > > I found jonckheere.test{clinfun}, but it uses a normal approximation > when ties are present in the data. ?To make this concrete, I've > include > a small dataset. ?Thanks. ?--Dale > > Hollander and Wolfe, 1999 Table 6.6, pg 205 > > control <- c(40, 35, 38, 43, 44, 41) > rough <- c(38, 40, 47, 44, 40, 42) > accurate <- c(48, 40, 45, 43, 46, 44) > > pieces <- list(control, rough, accurate) > n <- c(6, 6, 6) > grp <- as.ordered(factor(rep(1:length(n),n))) > > library(clinfun) > jonckheere.test(unlist(pieces), grp, alternative="increasing") > > > Output below ... >> jonckheere.test(unlist(pieces), grp, alternative="increasing") > > ? ? ? ?Jonckheere-Terpstra test > > data: > JT = 79, p-value = 0.02163 > alternative hypothesis: increasing > > Warning message: > In jonckheere.test(unlist(pieces), grp, alternative = "increasing") : > ?TIES: p-value based on normal approximation >
Maybe Matching Threads
- Unexpected results using the oneway_test in the coin package
- Jonckheere-Terpstra test
- Biobass, SAGx, and Jonckheere-Terpstra test
- Different result with "kruskal.test" and post-hoc analysis with Nemenyi-Damico-Wolfe-Dunn test implemented in the help page for oneway_test in the coin package that uses multcomp
- Kendall's tau code