I am trying to understand the results on the kruskal wallis test that are produced in R. The data that I am testing:

Class       Branch  LA_type Method_type     Method_call     Branch_type     Branch_condition    Tested_parameter
Goal        12      Smooth  public static   never called    IFNE            TRUE                 String
TreeApp     20      Rugged  constructor     none            IF_ICMPGE  FALSE                     int
Password    4       Smooth  private         never called    IFEQ    FALSE                        int
XMLParser   9       Rugged  constructor     none            IFNONNULL   TRUE                     String
MapClass    33      Smooth  public          never called    IFGT    FALSE                        double

We want to know where there is a difference between, for example, the method call of a smooth LA and the method call of a rugged LA. Note that this is only a sample to be shown here. When I apply the Kruskal-Wallis test with LA_type and Branch_type, I get the following result:

Kruskal-Wallis chi-squared = 33.657, df = 15, p-value = 0.003803

While the result of LA_type and Method_call is:

Kruskal-Wallis chi-squared = 85.377, df = 4, p-value < 2.2e-16

My question is what does the chi-squared mean? How does it indicate the significant difference between the groups? and is it really correct to say there is a significant difference between, for example, the method call of a smooth LA and the method call of a rugged LA?

  • 1
    $\begingroup$ I find the question hard to follow ... 1. What's the response variable being compared? 2. If you're only comparing two groups why use Kruskal-Wallis? 3. What is it you're originally trying to find out? $\endgroup$
    – Glen_b
    Commented Oct 10, 2019 at 12:39
  • 1
    $\begingroup$ The dependent variable for Kruskal-Wallis should be numeric, or at least ordinal. I'm wondering if you are (incorrectly) feeding the function a nominal dependent variable, and the function is coercing it to a numeric variable? $\endgroup$ Commented Oct 10, 2019 at 16:04
  • $\begingroup$ About the chi-sq part of your question. In some circumstances, the test statistic $H$ is approximately chi-squared: "If possible (no ties, sample not too big) one should compare $H$ to the critical value obtained from the exact distribution of $H.$ Otherwise, the distribution of $H$ can be approximated by a chi-squared distribution with $g-1$ degrees of freedom." Quoted from a longer explanation in Wikipedia on K-W test. $\endgroup$
    – BruceET
    Commented Oct 11, 2019 at 8:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.