|
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 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
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.
|
|
In reply to this post by eleetselad
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 <[hidden email]> 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 > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
| Powered by Nabble | Edit this page |
