The **Mood’s Median Test**, essentially a two sample version of the Sign Test, is used to determine whether the median of two independent samples are equal. To perform this test, you need to execute the following steps:

- Calculate the total median
*m*of the combination of the two samples. - Create a 2 × 2 contingency table whose first row consists of the number of elements in each sample that are greater than
*m*and whose second row consists of the number of elements in each sample that are less than or equal to*m* - Perform a chi-square test of independence
- If p-value <
*α*then the medians of the populations from which the two samples are derived are unequal; otherwise they are equal

**Example 1**: Repeat Example 2 of Two Sample t-Test with Equal Variance to determine whether the Drug and Control groups have the same median based on the data in Figure 1.

**Figure 1 – Data for Example 1**

As can be seen in Wilcoxon Ranked Sum Test when we repeat this example using the Wilcoxon ranked sum test, this data is not normally distributed and so we need to use a non-parametric test.

We execute the steps in Mood’s Median Test as shown in Figure 2. Column I shows the formulas used in column F.

**Figure 2 – Mood’s Median Tests for two samples**

Since p-value = .0405 < .05 = *α*, we reject the null-hypothesis, and conclude there is a significant difference between the two population medians.

**Observation**: Generally the Wilcoxon Rank Sum or Mann-Whitney test is used instead of Mood’s Median Test since they provide more accurate results.

**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.

For Example 1, MOODS_STAT(B4:C15) = 4.196 and MOODS_TEST(B4:C15) = .0405.

**Observation**: Mood’s Median Test can also be applied to more than two samples and can be viewed as a weak version of the Kruskal-Wallis test.

Dear Charles

i am Tariq Hussain, Ph.D. scholor.

i read that Mood’s Median test is more Robust to outliers as compared to Krushkall wallis test. But i did not knew how to prove it?

Help me plz….

Tariq,

That may be true, I can’t say for sure, but since Kruskal-Wallis uses ranks it should be pretty robust to outliers.

Charles

Thank you for explanation.

Mood’s median test is same as median test ?

if different then how they are different ?

I presume that they are the same, although perhaps there is another median test that I am not aware of.

Charles

Dear Charles,

I tested your two sample example of your site (median = 18, x^2 = 4.195, p = 0.0405) with the corresponding median test calculator of IFA (http://www.fon.hum.uva.nl/Service/Statistics/Median_Test.html) and I obtain the following results : median = 18, p = 0.0995 but without the corresponding numerical result for x^2.

Dear Charles,

I would strongly appreciate if you could give me a “scientific” explanation about this discrepancy.

Yours faithfully,

Alcibiades (B.C. 450 – B.C. 404)

In comparing your results with the corresponding ones from IFA (Holland) site, I found :

yours : p =

Alcibiades,

Thanks for your question. It forced me to relook at Mood’s Median test. The version that I explain on the Real Statistics website is based on a chi-square test for independence, which is reasonably accurate for larger samples, especially when none of the cells is less than 5. Since z is normally distributed if and only z^2 has a chi-square distribution, probably the approximation described on the referenced website that you provided is equivalent for large samples (or at least similar). I hedge because the site doesn’t say that it is using the Mood’s test, although it probably is.

Since I don’t have the data you used, I looked at the data on the website that you referenced. The samples there are small (9 and 12) and so they didn’t use the normal approximation, but used a permutation test instead. This is probably similar to the Fisher exact test, although I can’t say for sure, especially since they said that they would carry out the calculations favoring the null hypothesis. They came up with a result of p = .0484.

When I carried out the Mood Median test using the Real Statistics software I got p-value = .00372. This is based on a chi-square test where one of the four cells has a value of 1. This is not a good fit for the chi-square test. When I used the Fisher Exact Test, I got p-value = .00752.

I then noted that one of the values in sample 2 is 774, the exact same value as the overall median. In this case, we can optionally change the cell with value 1 to 2 (thereby favoring the null hypothesis). In this case, Fisher’s Exact Test yields the value .0300, which is still not the same as the value obtained on the referenced website, but much closer to that value.

I haven’t invested much effort into Mood’s Median test, simply because it is usually not used since other tests are more powerful. I any case, I plan to add the option to use the Fisher Exact Test version for small samples.

Charles

Can any one tell me the formula of The Median test for four samples??

Zanish,

See the following webpage:

Mood’s Median Test

Charles

Hello Charles,

I can’t find the =chi_stat, or =chi_test formulas on excel.

Do I need an add-in?

Thank you in advance,

Pablo

Pablo,

Yes, you need the Real Statistics add-in.

Charles

thank you very much Mr Charles.

i just need a clarification. i compared survival rates between two fly groups using both mood’s median test and Mann whitney. all were not significant, i wish to know wich one is best to report on and possibly why.

Best regards

Bertrand

You need to tell me more about the nature of your data before I am able to answer your question.

Charles

Hi Charles,

From this test, is it possible to tell whether or not two samples came from the same population?

K

No. This test doesn’t go that far.

Charles

Hey Charles,

Very many thanks for the fantastic info about the Test and your Excel Add-on.

I have one Question. How is it possible, or is it possible to use the Mood’s Median-Test for a one side test ? Respectively to evaluate which sample has the smaller values.

Maximillian,

I am not aware of a one-sided version of Mood’s Median Test.

If the test shows a significant difference between the medians, then it is safe to say that the group with the smaller sample median is the one with the smaller population median (with 100xalpha degree of confidence).

Charles

Tank you very much, for your answer.

Maximilian

Hi Charles,

I still do not understand Mood”s median test (for two samples), does it work for two samples with two different sample size? If so, I just use SAS did, proc code as following:

proc npar1way mood median data=expensediff;

var difference;

class group_cd;

run;

and the outputs for this step include median scores, median two_sample test, frequency above and below the overall median, and mood scores, Mood Two-Sample Test, distribution of mood scores.

but I am still confusing about the purpose for Mood’s Median Test, because I did not learn anything about it when I was in university.

Yang,

Mood’s median test can be used with samples of different sizes.

Usually there are other tests that can be used instead which have more power, which is probably why you didn’t learn about it when you were in university.

Charles

Charles,

I want to know which statistical test has to be used to compare medians among 3 groups i.e which is the analogous test similar to repeated measures ANOVA i.e median scores compared for same group at 3 time intervals (baseline, 3 months and 6 months)

Madhu,

The usual nonparametric test is Friedman’s Test.

Charles

Hi Charles,

Very many thanks for all of the fantastic info on your site.

I am trying to replicate the example you have here in R and am failing to get the same p-value as yourself. If I use the exact method based on Fisher I get a p-value = 0.0995. I can get to this value by either using this code:

control = c(11,15,9,4,34,17,18,14,12,13,26,31)

drug = c(34,31,35,29,28,12,18,30,14,22,10,29)

data = c(control, drug)

label = gl(2, 12, labels = c(“Control”,”Drug”))

mood.medtest(data~label, exact = TRUE)

or by using this function:

median.test <- function(x, y){

z <- c(x, y)

g <- rep(1:2, c(length(x), length(y)))

m <- median(z)

fisher.test(z < m, g)$p.value

}

median.test(drug,control)

If I set exact in the first example to FALSE, which then uses a chi-squared test with a Yates continuity correction, I get a p-value of 0.1013, and if I try the following on the contingency table you give above:

a = matrix(data = c(3,8,9,4), nrow=2, ncol=2, byrow=TRUE)

chisq.test(a)

I also get a p-value of 0.1013

Can you shed some light on what might be happening here?

Thanks again for the really great resource you've created here.

Phil

Phil,

Thanks for the clarification. It is difficult for me to comment since I don’t use R and so don’t know what assumptions are being made. Did you see a specific error in what I wrote?

Charles