Hi, Try: pairw.kw(y,factor(x),conf=.95)
A.K. On Monday, October 21, 2013 7:10 PM, luigi marongiu <marongiu.lu...@gmail.com> wrote: Dear all, I am trying to apply a post hoc test to a significant Kruskal-Wallis test. I eventually found the function ‘pairw.kw()’ of the package “asbio”. This function has the following syntax: pairw.kw(y, x, conf) Arguments y The response variable. A vector of quantitative responses. x An explanatory variable. A vector of factor levels. conf The level of desired confidence, 1 - P(type I error). The example reported indicated 2 vectors of length 12 arranged in a data frame: rye.data <- data.frame(rye = c(50, 49.8, 52.3, 44.5, 62.3, 74.8, 72.5, 80.2, 47.6, 39.5, 47.7,50.7), nutrient = factor(c(rep(1, 4), rep(2, 4), rep(3, 4)))) with(rye.data, pairw.kw(y = rye, x = nutrient, conf = .95)) I tried to arrange the data in this way, as well as using my own dataframe obtained from the read.table() function and directly with two vectors, but I always obtained an error. Essentially the two vectors are not of the same length; this is incorrect since there are both 64 elements. Is there somebody who could tell me how to use this function? Many thanks, Luigi EXAMPLE GIVEN Here I am using the vector example. ### define vectors x<-c( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4) y<-c( 0.002515324, 0.005128344, 0.008474943, 0.009992525, 0.01460982, 0.020567249, 0.069597233, 0.192428254, 0.636910481, 0.673830995, 4.354055891, 4.847755691, 0.403135211, 0.539626363, 0.892722111, 0.993636963, 1.289747804, 3.766986726, 5.623002684, 8.52186547, 17.24684431, 19.84624792, 25.9529251, 35.64632645, 0.437492775, 0.594863773, 0.64377689, 0.88033664, 3.199906591, 5.745723357, 6.339129057, 6.583851172, 11.27921212, 13.01230334, 14.61151433, 26.68041064, 52.42360789, 71.88062442, 91.34132781, 115.1038548, 0.059333604, 0.068746428, 0.1473799, 0.220983138, 0.959677864, 1.21197612, 2.860983172, 4.402992963, 5.122748306, 8.711530662, 25.6245157, 44.0798333, 45.24736747, 66.4490478, 86.60427738, 0.10348061, 0.390758249, 0.634667258, 1.122594755, 2.726868877, 4.15194739, 5.361175006, 8.825635885, 45.75640999) ### confirm length: length(x) # 64 length(y) # 64 ### KRUSKAL-WALLIS to test inter-group differences kruskal.test(y, x) # p-value = 0.0008701 ### Multiple pairwise comparison procedure to accompany a Kruskal-Wallis test pairw.kw(y, x, conf = .95) # Error in outer(levels(x), levels(x), function(x1, x2) { : # dims [product 0] do not match the length of object [1] [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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. ______________________________________________ R-help@r-project.org 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.