I would like to compare more than 2 groups (their dependent variable is not distributed normally).

Can I use the Anderson-Darling test like I would use the Kruskal-Wallis test? I have no specific reason to choose the former, this is mainly a way to learn something new about nonparametric tests.

(I use R)

I read this: https://en.wikipedia.org/wiki/Anderson%E2%80%93Darling_test#Non-parametric_k-sample_tests


Non-technical response: The tests look at different things. The documentation for the kSamples package does an okay job suggesting how they are different. It's my understanding that Anderson-Darling is testing if the distributions are the same overall, whereas Kruskal-Wallis is looking for a stochastic difference, that is specifically if the values in one distribution is higher than in the other. Practically speaking, the question you are trying to answer with each of these is very different.

The following example will produce a vector X with normally-distributed values, a median of 0, and a range of about -25 to 25. Y will be a vector with simply twice the values of X.

The Anderson-Darling test will report that they are different distributions. The distributions are similar in shape and location, but the range of Y is twice that of X.

Kruskal-Wallis, however, will not find a stochastic difference between the two distributions, since they are similar in shape with the same medians. It's not the case that the values of one distribution are greater than those of the other.

X = rnorm(100)*10
X = X - median(X)
Y = X * 2

Value = c(X, Y)
Group = c(rep("X", length(X)), rep("Y", length(X)))
Data  = data.frame(Group, Value)

histogram(~ Value | Group,

enter image description here

ad.test(Value ~ Group, data=Data)

### Anderson-Darling k-sample test.

###               AD  T.AD  asympt. P-value
### version 1: 5.248 5.632         0.002071
### version 2: 5.290 5.692         0.001974

kruskal.test(Value ~ Group, data=Data)

### Kruskal-Wallis rank sum test

### Kruskal-Wallis chi-squared = 0.016143, df = 1, p-value = 0.8989


###    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
### -20.900  -4.992   0.000   1.256   8.637  24.812 

###    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
### -41.800  -9.984   0.000   2.512  17.274  49.624 
  • $\begingroup$ Very informative example, thank you. It will help my study $\endgroup$ – statisticianwannabe Dec 13 '17 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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