Summary and Analysis of Extension Program Evaluation in R

Salvatore S. Mangiafico

Mood’s Median Test for Two-sample Data

Mood’s median test compares the medians of two or more groups.  It is often less powerful than the Mann–Whitney U test, but can be used when the spread of values in the groups are different due to outliers.


The test can be conducted with the mood.medtest function in the RVAideMemoire package.


Appropriate data

•  One-way data with two or more groups

•  Dependent variable is ordinal, interval, or ratio

•  Independent variable is a factor with levels indicating groups

•  Observations between groups are independent.  That is, not paired or repeated measures data

•  Distributions of values for each group are similar in shape; however, the test is not sensitive to outliers



•  Null hypothesis:  The medians of values for each group are equal.

•  Alternative hypothesis (two-sided): The medians of values for each group are not equal.



Significant results can be reported as “The median value of group A was significantly different from group B.”


Packages used in this chapter


The packages used in this chapter include:

•  RVAideMemoire


The following commands will install these packages if they are not already installed:


Example using the RVAideMemoire package


This example uses the formula notation indicating that Likert is the dependent variable and Speaker is the independent variable.  The data= option indicates the data frame that contains the variables.  For the meaning of other options, see ?mood.medtest.


For appropriate plots and data frame checking, see the Two-sample Mann–Whitney U Test chapter.


Input =("
 Speaker  Likert
 Pooh      3
 Pooh      5
 Pooh      4
 Pooh      4
 Pooh      4
 Pooh      4
 Pooh      4
 Pooh      4
 Pooh      5
 Pooh      5
 Piglet    2
 Piglet    4
 Piglet    2
 Piglet    2
 Piglet    1
 Piglet    2
 Piglet    3
 Piglet    2
 Piglet    2
 Piglet    3

Data = read.table(textConnection(Input),header=TRUE)

###  Check the data frame





### Remove unnecessary objects


Mood’s Median Test


mood.medtest(Likert ~ Speaker,
             data = Data)

Mood's median test

p-value = 0.001093