Mood’s median test compares the medians of two or more groups. The test can be conducted with the mood.medtest function in the RVAideMemoire package or with the median_test function in the coin package.
• 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
• Null hypothesis: The medians of the populations from which the groups were sampled are equal.
• Alternative hypothesis (two-sided): The medians of the populations from which the groups were sampled are not equal.
Significant results can be reported as “The median value of group A was significantly different from group B.”
The packages used in this chapter include:
The following commands will install these packages if they are not already installed:
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 summary statistics, see the Two-sample Mann–Whitney U Test chapter.
Data = read.table(textConnection(Input),header=TRUE)
### Check the data frame
### Remove unnecessary objects
mood.medtest(Likert ~ Speaker,
data = Data,
exact = FALSE)
Mood's median test
X-squared = 9.8, df = 1, p-value = 0.001745
### Median test by Monte Carlo
median_test(Likert ~ Speaker,
data = Data,
distribution = approximate(B = 10000))
Approximative Two-Sample Brown-Mood Median Test
Z = -3.4871, p-value = 0.0011