Introduction
For completeness, we now present another non-parametric replacement for one-way ANOVA, namely Mood’s Median Test. This test is essentially an extension of the Sign Test to two or more variables. We have already described this test for two independent variables in Mood’s Median Test for Two Samples.
The Kruskal-Wallis test has more power and is preferred to Mood’s Median Test since it takes into account the ranking of data whereas Mood’s Median Test just takes into account whether a data element is larger or smaller than the median.
Example
Example 1: Repeat Example 1 of Kruskal-Wallis Test using Mood’s Median Test.
The approach, as shown in Figure 1, is exactly the same as that described in Mood’s Median Test for Two Samples where we have one column in the contingency table for each independent variable.
Figure 1 – Mood’s Median Test
We see that the p-value = 0.100196 > .05 = α, and so the null hypothesis is not refuted. We conclude there is no significant difference between the three creams being tested. This is different from the result obtained from Kruskal-Wallis.
Worksheet Functions
Real Statistics Functions: The Real Statistics Pack provides the following functions:
MOODS_STAT(R1) = the chi-square test statistic for Mood’s Median test where R1 contains the sample data.
MOODS_TEST(R1) = the p-value statistic for Mood’s Median test where R1 contains the sample data.
As we can see from Figure 1, χ2 = MOODS_STAT(A4:C13) = 4.60125 and p-value = MOODS_TEST(A4:C13) = 0.100196.
Examples Workbook
Click here to download the Excel workbook with the examples described on this webpage.
Reference
Scott, R. (2019) Understanding the uses for Mood’s median test
https://processnews.blogspot.com/2019/10/understanding-uses-moods-median-test.html
I’m not surprised – neither Mann-Whitney nor Kruskal-Wallis are tests of medians and both can fail miserably at this, unless strong assumptions hold:
1) both samples are IID: same dispersion, same shape (if skewed, then in the same direction) – tests pseudomedian change
2) both samples are symmetric around the medians tests median difference.
If the two assumptions don’t hold, you simply cannot, by no mean, attribute the difference to medians, because this test is sensitive to multiple things.
Even worse, rank based tests assess pseudomedian difference, which is NOT difference of medians (unlike means).
So I would first check the Brunner-Munzel, which accounts *partially* for different dispersions and validate it with quantile regression.
But never I would trust here Mann-Whitney (Wilcoxon) or Kruskal-Wallis unless the variances are same and shapes are same.
For rich literature set (free access) and examples I made please check: https://gist.github.com/adrianolszewski/2cec75678e1183e4703589bfd22fa8b2
Example 1 here (Mood’s) results in p=0.100 (no significant difference). The same Example 1 for Kruskal-Wallis results in p=0.012 (significant difference). The box plot comparisons (Figure 2 in Kruskal-Wallis) show overlapping whiskers, but IQR for “New” doesn’t overlap IQR for “Old” and “Control” so I’m inclined to believe the Kruskal-Wallis result.
Comments? Under what circumstances would you prefer one test over the other when they show a difference like this?
Well, please check https://github.com/adrianolszewski/Mann-Whitney-is-not-about-medians-in-general
I would believe the Brown-Mood test here, unless you confirmed that 1) both samples are IID (same dispersion, same shape), 2) both distributions are symmetric. You can also validate it with quantile regression, which makes no assumptions like the above.
Adrian,
Thanks for your clarifications. The Mann-Whitney test is equivalent to the Wilcoxon Rank-Sum test. Both tests can be used to compare median only when additional assumptions are made, but they can still be used to compare two samples, as described in
https://real-statistics.com/non-parametric-tests/wilcoxon-rank-sum-test/
Charles
Yes, you are 100% right. All rank-based methods (including ATS – ANOVA-Type Statistic, WTS = Wald’s Type Statistic, ART ANOVA, Conover’s ANOVA-on-ranks, and they older brothers: Mann-Whitney, Kruskal-Wallis, Friedman, Brunner-Munzel) will compare samples but in a “general way”, I mean – they can be sensitive to differences in locations (including medians), dispersions (alone; when both medians are exactly equal, as in my simulations) and shapes. Then it’s similar to CDF-comparing methods, like Anderson-Darling, Cramer-von Mises or their oldest brother – Kolmogorov-Smirnov, which look at the CDF distance, but not specifically on a concrete parameter. One needs to decide what’s the research hypothesis. Sometimes we want to focus on location shift, sometimes we care about the dispersions, sometimes about the shape (if observations concentrate towards smaller or larger values, if multiple modes diminish, and so on), and sometimes – all together. Then rank-based tests are perfect. Though quantile regression, performed at several quartiles (say, minimum=q0, q1, median=q2, q3, maximum=q4) may provide more informative answer. But when our goal is to focus on comparing means or medians, applying these tests without the additional assumptions will test a different hypothesis: stochastic superiority, which is much, much more general. And then no surprise that for med1=med2 p-value may go below 0.00000001 if dispersions or shapes (not only skewness, also kurtosis, modes) vary a lot.
Adrian,
The Real Statistics website also includes a few permutation exact tests, including
https://real-statistics.com/non-parametric-tests/mann-whitney-test/mann-whitney-exact-test/
https://real-statistics.com/non-parametric-tests/permutation-test-for-two-independent-samples/
I need to see how these compare with Brunner-Munzel.
Charles
How to calculate which median is great then other median
Hi Tanmay,
The largest of the group sample medians is an estimate of the largest group population median. This doesn’t mean that this group has a median that is significantly different from the median of the other groups. Your question is related to post-hoc tests after a significant Mood’d Median Test. See, for example,
https://faqs.tips/post/what-post-hoc-tests-are-available-for-mood-median-test.html
Charles
Hello, I was really excited when I came across this, unfortunately, in MS Excel with office 365 even with the AnalyzePak add-on I don’t seem to have neither the MOODS_STAT nor the MOODS_TEST functions anymore. I tried using the function wizard to find its replacement, but don’t seem to find any. I am missing something obvious?
Hello Francoise,
These are not standard Excel functions. They are provided by the Real Statistics resource pack. You can download and install this software for free. This will enable you to use an expanded range of Excel functions as well as data analysis tools.
You can download the software from
https://www.real-statistics.com/free-download/real-statistics-resource-pack/
Charles
who invented moods median test??thanks
Tyron,
I am not sure, but the following may help:
Brown, G. W.; Mood, A. M. On Median Tests for Linear Hypotheses. Proceedings of the Second Berkeley Symposium on Mathematical Statistics and Probability, 159–166, University of California Press, Berkeley, Calif., 1951. http://projecteuclid.org/euclid.bsmsp/1200500226
Charles