3
$\begingroup$

I need a non-parametric test for my project (because I can't be sure that the distribution would always be normal), so I decided to use Kruskal-Wallis test. But the problem is that Kruskal-Wallis test doesn't return the correct result if the groups doesn't have the same variability. Does Kruskal-Wallis test has a non-parametric analogue that isn't sensitive to groups having different variability?

$\endgroup$
2
  • 1
    $\begingroup$ Welcome to Cross Validated! How do you know that KW is returning the wrong result? $\endgroup$
    – Dave
    Commented Jan 22, 2022 at 12:57
  • $\begingroup$ @Dave, I've read on the internet when I could use KW and it was said that I could use it when distribution had the same "shape" (no heteroscadicity) $\endgroup$
    – No Name
    Commented Jan 22, 2022 at 15:20

3 Answers 3

7
$\begingroup$

As well stated by @Glen_b the K-W test works as advertised in the unequal dispersion setting. In general it is difficult in such settings to know what estimand to seek or what conclusions to draw.

The K-W test is a special case of the proportional odds ordinal logistic model - one that contains only mutually exclusive indicator variables for the groups. Unequal dispersion is related to the proportional odds assumption, and you can generalize the model to allow continuous or discontinuous transition in group effects that are analogous to scale changes, using the partial proportional odds model as implemented in the R VGAM and rmsb packages.

$\endgroup$
5
$\begingroup$

They are assumed to have the same shape and spread under the null. It's not necessarily required under the alternative. You don't know if the null is true so this is also not something you can "check" on the data -- it's an assumption.

While a pure location-shift alternative may be relatively easy to interpret, it's often not realistic. For example, in some situations spread is related to mean. In some situations shape is related to mean. Consider test scores, for example; as the average score gets very high, not only does the variance tend to reduce as the values squash up against the upper bound but they tend to become more (left) skew as well.

The Kruskal-Wallis can work perfectly sensibly on sequences of alternatives that have spread and shape smoothly changing as the location changes.

Note that the Kruskal-Wallis is unaltered by monotonic transformations of the response variable (it doesn't change the ranks). A pure-location shift alternative on one scale will NOT be pure location-shift after such a transformation, but the test behaves just as sensibly either way.


If you're in a situation where you can't assume exchangeability under the null, you won't satisfy the conditions under which a permutation test would be able to "permute" things.

You may still be able to do a (carefully chosen/constructed) bootstrap test (/confidence interval for some effect of interest). In large samples it should have close to the required properties.

$\endgroup$
0
$\begingroup$

Example: Consider the following fictitious data:

set.seed(2022)
x1 = rgamma(50, 2, .3)
x2 = rgamma(50, 3, .3)
x3 = rgamma(50, 4, .3)
x = c(x1, x2, x3)
g = rep(1:3, each=50)

The three groups have different variances and slightly different skewnesses.

boxplot(x~g, horizontal=T, col=c("maroon","green3","blue"))

enter image description here

Kruskal-Wallis test shows differences with P-value near $0.$

kruskal.test(x~g)

        Kruskal-Wallis rank sum test

data:  x by g
Kruskal-Wallis chi-squared = 42.46, df = 2,
p-value = 6.023e-10

A plot of empirical CDFs (ECDFs) shows that sample x3 (blue) stochastically dominates x2, which in turn stochastically dominates x1.

hdr = "ECDF plots of x1 (maroon), x2 (green) and x3"
plot(ecdf(x3), col="blue", main=hdr)
 lines(ecdf(x2), col="green3")
 lines(ecdf(x1), col="maroon")

enter image description here

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.