Kruskal Wallis H Test

The Kruskal Wallis H test is the nonparametric equivalent for an Analysis of Variance. If you have a grouping variable, such as which class, and an outcome variable, such as: Percent of Improvement, AND your data is not parametric, Kruskal & Wallis are your people for the job.

embed 30 is thirty

Read any good data lately?

Get your Data into your R program, but whatever means available to you.

prepost <-read.delim("/Volumes/Mirror Mirror /Google Drive/Research_UMKC/SE4SW.FE/T_Tests/prepost.txt")

next do you Kruskal Wallis Test, by using the following formula.

the name of the test is kruskal.test, which tells R which test you want.

the PERCENTIMP is the numeric variable you are wanting to test to see if there are differences between the different categories.

Be sure to separate the two by a ‘~’ (tilde sign) which is located on the upper left key, left of the 1 key on a standard US keyboard.

where you see Class that is the name of the factor variable that you are using. Remember it must have 3 or more categories or else you are using the wrong test. If you have a two-factor variable, for example Female - Male, or TRUE - FALSE, then you want to use the Wilcoxon Signed Rank Test, also called the Mann-Whitney U. Go here if that is the case Go to the Wilcoxon Test Page.

data = pretest tells R to look in the dataset named ‘pretest’ in this case, be sure to substitute your dataset’s name.

be sure you enclose everything in parentheses.

kruskal.test(PERCENTIMP~Class, data = prepost)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  PERCENTIMP by Class
## Kruskal-Wallis chi-squared = 1.401, df = 2, p-value = 0.4963

We can see that the kruskal.test gives us an output that is not signficant 0.4963324 so we would accept the H:0 as the most attractive explaination.

If we were writing an APA report, we might say something like: A Kruskal-Wallis Rank Sum Test was performed using R, Χ2(2) = 1.4, P = 0.5.