rank - kruskal-wallis contrast test in r -
all,
i perform equivalent of tukeyhsd on rank ordering median shift test such kruskal wallis
x=matrix(c(1,1,1,1,2,2,2,4,4,4,4,4,1,3,6,9,4,6,8,10,1,2,1,3),ncol=2) anova=aov(x[,2]~factor(x[,1])) tukeyhsd(anova) ## tukey multiple comparisons of means ## 95% family-wise confidence level ## ## fit: aov(formula = x[, 2] ~ factor(x[, 1])) ## ## $`factor(x[, 1])` ## diff lwr upr p adj ## 2-1 1.25 -5.927068 8.427068 0.8794664 ## 4-1 -1.35 -7.653691 4.953691 0.8246844 ## 4-2 -2.60 -9.462589 4.262589 0.5617125 kruskal.test(x[,2]~factor(x[,1])) ## ## kruskal-wallis rank sum test ## ## data: x[, 2] factor(x[, 1]) ## kruskal-wallis chi-squared = 1.7325, df = 2, p-value = 0.4205
i analyze contrasts. please help. thanks. rik
if want multiple comparisons after kruskal-wallis test, need kruskalmc
function pgirmess
package. before can implement function, need transform matrix dataframe. in example:
# convert matrix dataframe dfx <- as.data.frame(x) # kruskal-wallis test & output kruskal.test(dfx$v2~factor(dfx$v1)) kruskal-wallis rank sum test data: dfx$v2 factor(dfx$v1) kruskal-wallis chi-squared = 1.7325, df = 2, p-value = 0.4205 # post-hoc tests & output kruskalmc(v2~factor(v1), data = dfx) multiple comparison test after kruskal-wallis p.value: 0.05 comparisons obs.dif critical.dif difference 1-2 1.75 6.592506 false 1-4 1.65 5.790265 false 2-4 3.40 6.303642 false
Comments
Post a Comment