views:

404

answers:

2

I have this example from the coin package of R:

  library(coin)
  library(multcomp)
  ### Length of YOY Gizzard Shad from Kokosing Lake, Ohio,
  ### sampled in Summer 1984, Hollander & Wolfe (1999), Table 6.3, page 200
  YOY <- data.frame(length = c(46, 28, 46, 37, 32, 41, 42, 45, 38, 44, 
                               42, 60, 32, 42, 45, 58, 27, 51, 42, 52, 
                               38, 33, 26, 25, 28, 28, 26, 27, 27, 27, 
                               31, 30, 27, 29, 30, 25, 25, 24, 27, 30),
                    site = factor(c(rep("I", 10), rep("II", 10),
                                    rep("III", 10), rep("IV", 10))))

  ### Nemenyi-Damico-Wolfe-Dunn test (joint ranking)
  ### Hollander & Wolfe (1999), page 244 
  ### (where Steel-Dwass results are given)
  NDWD <- oneway_test(length ~ site, data = YOY,
      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 = 90000))

  ### global p-value
  print(pvalue(NDWD))

  ### sites (I = II) != (III = IV) at alpha = 0.01 (page 244)
  print(pvalue(NDWD, method = "single-step"))

I want to assign alpha a different value, how can I do this??

This doesn't work!

  library(coin)
  library(multcomp)
  ### Length of YOY Gizzard Shad from Kokosing Lake, Ohio,
  ### sampled in Summer 1984, Hollander & Wolfe (1999), Table 6.3, page 200
  YOY <- data.frame(length = c(46, 28, 46, 37, 32, 41, 42, 45, 38, 44, 
                               42, 60, 32, 42, 45, 58, 27, 51, 42, 52, 
                               38, 33, 26, 25, 28, 28, 26, 27, 27, 27, 
                               31, 30, 27, 29, 30, 25, 25, 24, 27, 30),
                    site = factor(c(rep("I", 10), rep("II", 10),
                                    rep("III", 10), rep("IV", 10))))

  ### Nemenyi-Damico-Wolfe-Dunn test (joint ranking)
  ### Hollander & Wolfe (1999), page 244 
  ### (where Steel-Dwass results are given)
  NDWD <- oneway_test(length ~ site, data = YOY,
      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 = 90000),
      alpha = 0.05)

  ### global p-value
  print(pvalue(NDWD))

  ### sites (I = II) != (III = IV) at alpha = 0.05 (default was 0.01) (page 244)
  print(pvalue(NDWD, method = "single-step"))
A: 

It would appear that you cannot: oneway_test() has no argument conf.level whereas wilcox_test and normal_test do. This is all documented, see help(oneway_test).

Dirk Eddelbuettel
but they say in the original example alpha = 0.01, how do they set if I cannot?
Cetin Sert
[link to example](http://rss.acs.unt.edu/Rdoc/library/coin/html/LocationTests.html)
Cetin Sert
This is open source, so may I suggest you read the source? I was simply pointing out to you that the _documented_ interface does not support it.
Dirk Eddelbuettel
I already downloaded and tried to read the source but there was no mention of a matching-named variable/symbol in the sources o__O So I now think that alpha may be something that goes under different names in the comment and code.
Cetin Sert
I haven't looked at the source, but sometimes you use sigma rather than alpha. That's not to say that alpha _is_ sigma, but you can convert from one to the other.
Nosredna
+2  A: 

The alpha levels are hardcoded and fixed at 0.99 If you want to change that, then you have to download the package source, change the levels and compile the package. The levels are coded in the Methods.R file. Search for binom.test or conf.level

You could ask the package author to change the package so you can set the level yourself. But bear in mind that the package author is not obliged to do that!

Thierry
so if I want to set alpha to 0.05 as was intended, I need to change conf.levels to 0.95? is that right?
Cetin Sert
Yep. The confidence level is (1 - alpha)
Thierry