How to Run Kruskal–Wallis Test on Exploratory

Note: This article was written back when Exploratory did not have Analytics View for Kruskal-Wallis test. With the latest versions of Exploratory, Kruskal-Wallis test can be run with GUI support of Analytics View.

Kruskal–Wallis Test is non parametric test to tell whether samples from different groups are coming from a same distribution.

Here, I’m testing if cars with different number of forward gears have same distribution of miles/gallon.

Create Model

With do command in Custom R Command Step, create model of Kruskal-Wallis test.

do(model=kruskal.test(mpg~gear,data=.))

This creates a model column.

Extract Test Results by broom’s tidy command

Using tidy command from broom package, you can extract the result from the model columbn, as a data frame, like following.

tidy(model)

This creates a step which has the result as a data frame like following.

In this case, P value is very low, and we can safely say cars with different number of gears have different distributions on their mile/galon.

Loading...