Kruskal-Wallis


> library(agricolae)
> library(coin)
> data("PlantGrowth")
> PlantGrowth
   weight group
1    4.17  ctrl
2    5.58  ctrl
3    5.18  ctrl
4    6.11  ctrl
5    4.50  ctrl
6    4.61  ctrl
7    5.17  ctrl
8    4.53  ctrl
9    5.33  ctrl
10   5.14  ctrl
11   4.81  trt1
12   4.17  trt1
13   4.41  trt1
14   3.59  trt1
15   5.87  trt1
16   3.83  trt1
17   6.03  trt1
18   4.89  trt1
19   4.32  trt1
20   4.69  trt1
21   6.31  trt2
22   5.12  trt2
23   5.54  trt2
24   5.50  trt2
25   5.37  trt2
26   5.29  trt2
27   4.92  trt2
28   6.15  trt2
29   5.80  trt2
30   5.26  trt2

> kruskal.test(weight~group, data=PlantGrowth)

	Kruskal-Wallis rank sum test

data:  weight by group
Kruskal-Wallis chi-squared = 7.9882, df = 2, p-value = 0.01842

> kruskal(PlantGrowth$weight, PlantGrowth$group, console = TRUE)

Study: PlantGrowth$weight ~ PlantGrowth$group
Kruskal-Wallis test's
Ties or no Ties

Critical Value: 7.988229
Degrees of freedom: 2
Pvalue Chisq  : 0.01842376 

PlantGrowth$group,  means of the ranks

     PlantGrowth.weight  r
ctrl              14.75 10
trt1              10.35 10
trt2              21.40 10

Post Hoc Analysis

t-Student: 2.051831
Alpha    : 0.05
Minimum Significant Difference: 7.125387 

Treatments with the same letter are not significantly different.

     PlantGrowth$weight groups
trt2              21.40      a
ctrl              14.75     ab
trt1              10.35      b