[R] Unexpected results using the oneway_test in the coin package

Mark Difford mark_difford at yahoo.co.uk
Tue Jan 10 08:17:13 CET 2012

On Jan 09, 2012 at 11:48am Christoph Liedtke wrote:

> I should be detecting some non-significance between groups I and III at
> least, but the test comes back with 
> extremely low p-values.  Where am I going wrong?

Nowhere, I think. This does seem to be an error in coin. You should send
your example to the maintainers of the package. Apart from the visual you
have provided, other reasons for thinking that this is an error are the

First, if you redo the analysis excluding habitat II, then the contrast is
not significant, as expected. Secondly, if you repeat the full analysis
using package nparcomp then you get the results you are expecting, based on
the graphical representation of the data. See the examples below.

## drop habitat == II
NDWD <- oneway_test(breeding ~ habitat, data = droplevels(subset(mydata,
habitat != "II")), 
        ytrafo = function(data) trafo(data, numeric_trafo = rank), 
        xtrafo = function(data) trafo(data, factor_trafo = function(x) 
            model.matrix(~x - 1) %*% t(contrMat(table(x), "Tukey"))), 
        teststat = "max", distribution = approximate(B = 900000)) 

print(pvalue(NDWD, method = "single-step"))

## use nparcomp
npar <- nparcomp(breeding ~ habitat, data = mydata, type = "Tukey")

Regards, Mark.

Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
View this message in context: http://r.789695.n4.nabble.com/Unexpected-results-using-the-oneway-test-in-the-coin-package-tp4278371p4281329.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list