|
Kruskal Wallis procedure demonstrated with an example
The Kruskal-Wallis testKruskal-Wallis test can be considered as a backup method for ANOVA where the independent variable is categorical but the dependent variable are not normally distributed. On the other hand, Kruskal-Wallis test can also be considered an alternative method for Mann-Whitney test where it is a nonparametric test but the independent variable could have more than two categories. In summary, Kruskal-Wallis test is preferred when:
Analyzing the data with Kruskal-Wallis testFor example, suppose weights of poplar trees are different based on treatments (none treatment, fertilizer, irrigation, or fertilizer and irrigation). Each weight samples that determined by the treatments is independent and random, and each sample size is 5. But the weight samples are not normally distributed. The research question is to test whether the poplar tree weights are different under the four treatments. The data is "poplar.csv". A Kruskal-Wallis test is performed as following. Open the data set from SAS. Or import with the following command. data poplar; infile "H:\sas\data\poplar.csv" dlm=',' firstobs=2; input weight treat $; run; proc npar1way data=poplar; class treat; var weight; run; The key output and intepretationUnder the Wilcoxon Analysis output, the test results can be found and shown here. The NPAR1WAY Procedure Wilcoxon Scores (Rank Sums) for Variable weight Classified by Variable treat Sum of Expected Std Dev Mean treat N Scores Under H0 Under H0 Score _____________________________________________________________________ no 5 45.00 52.50 11.443511 9.00 fert 5 37.50 52.50 11.443511 7.50 irrig 5 42.50 52.50 11.443511 8.50 f_i 5 85.00 52.50 11.443511 17.00 Average scores were used for ties. Kruskal-Wallis Test Chi-Square 8.2329 DF 3 Pr > Chi-Square 0.0414 The p-value is 0.0414 (<0.05), so we reject the null hypothesis, and there is sufficient evidence to reject the claim that the populations of poplar tree weights from the four treatments have equal medians. At least one of the medians appears to be different from the others. Comparing with F test, Kruskal-Wallis test is easier without checking assumptions of Normal distribution. However, the Kruskal-Wallis test is not as efficient as the F test, so it might require more dramatic differences for the null hypothesis to be rejected.
|
© COPYRIGHT 2010 ALL RIGHTS RESERVED tqin@purdue.edu |