AI Glossary / Statistics and probability / Intermediate
Median test
Definition
The median test, commonly called Mood's median test, is a nonparametric procedure for comparing the population medians of two or more independent groups. It classifies observations according to whether they fall above or below the median of the pooled data, then analyzes the resulting contingency table. The procedure emphasizes which side of that dividing point observations occupy rather than how far they lie from it.
What it means
The question is whether the groups differ in their central location as assessed through this pooled-median split. If one group has many more observations above the dividing point than another, that pattern can provide evidence against the null hypothesis under the test's assumptions.
The median test is not a comparison of means and does not estimate the size of a median difference by itself. It is also distinct from a one-sample sign test, a paired sign test, and Mood's test for scale, despite the similar names.
How it works
Collect independent samples from the groups of interest. Pool their observations and calculate the grand median. For each group, count values above and below that median. With k groups, the resulting table has two rows and k columns.
Specify how values exactly equal to the grand median are handled. They may be placed in one row or excluded, depending on the procedure. When ties are common, that decision can materially change the result and the interpretation of the table.
A common implementation uses Pearson's chi-square statistic: sum the squared differences between observed and expected cell counts divided by the expected counts. Expected counts are calculated from the row and column totals under independence. The usual large-sample reference distribution has k minus one degrees of freedom when the table is nondegenerate.
For two groups, some implementations apply a continuity correction. Sparse tables may require another justified approach rather than relying on a poor chi-square approximation. Document the method actually used.
Interpret the result with the sampling design and distributional assumptions in mind. Continuous distributions with well-defined medians provide the cleanest setting. Discrete outcomes and many ties complicate a simple median interpretation. Repeated observations from the same person or unit do not become independent merely because they are entered in different columns.
Three practical examples
- Service comparison: analysts compare independent samples of completion times from separate processes, reporting the observed medians as well as the test.
- Product testing: a team examines time-to-completion measurements for independent users assigned to different interface designs.
- Learning project: someone compares independent groups' task durations while investigating how discarding distance information affects conclusions relative to other methods.
Think of it this way
Think of placing a fence at the middle of all observations and counting each group's members on either side. The test uses those counts. An observation just beyond the fence and one very far beyond it count equally, so the method retains the side of the fence but discards the distance.
Worked example
Group A has values 1, 2, 3, 4, 5, 6, 7, 8, 21, and 22. Group B has values 9 through 18. The pooled middle observations are ten and eleven, so the grand median is 10.5. There are no ties at that value.
Group A contributes two observations above and eight below the grand median. Group B contributes eight above and two below. Each group contains ten observations, and the pooled totals are ten above and ten below. Every expected cell count is therefore 10 × 10/20 = 5.
Without continuity correction, the Pearson statistic is four times (3 squared divided by 5), giving 7.2. With one degree of freedom, its approximate chi-square tail probability is 0.00729. Applying the usual two-by-two continuity correction instead gives four times (2.5 squared divided by 5) = 5, with approximate p-value 0.02535.
The observed group medians are 5.5 and 13.5. These descriptive values communicate the direction and magnitude in this sample. The two p-values illustrate why the correction setting must be stated; they are not two independent confirmations of a result.
Illustrative case study
Fictional case: Cedar Tasks compares completion times from independent users of two prototypes. The analyst notices that many times were rounded to whole minutes and that several equal the pooled median. Before interpreting the test, the team specifies its tie rule and checks sensitivity to that choice.
It reports group medians, sample sizes, and the distribution of times alongside the selected test result. This fictional scenario illustrates transparent analysis and does not claim that a statistically detectable difference establishes a commercially important benefit.
Common misconceptions and mistakes
Do not treat a large p-value as proof that population medians are identical. The study may have limited power. The median split discards information about both ordering within each side and distance from the split, which can reduce sensitivity compared with methods that use more information.
Do not apply the independent-samples procedure unchanged to before-and-after measurements on the same participants. Do not choose the tie handling or correction after inspecting which option produces a preferred conclusion.
A significant result across several groups does not identify which pairs differ. Any follow-up comparisons need an appropriate analysis plan. Nor does a test establish that group membership caused the difference without a design supporting causal inference.
Business use
Use the median test when its question and assumptions fit the study, and understand the cost of its coarse data reduction. Consider whether direct interval estimation for median differences or another justified method would better support the decision.
A useful report gives the grand median, group medians, count table, tie rule, statistic, degrees of freedom, correction, p-value, and practical context. Check independence and expected counts rather than treating the nonparametric label as meaning assumption free.
People also ask
Does the test require normally distributed outcomes?
No, normality is not its defining requirement.
Does it use every observation's distance from the median?
No, it uses the above-or-below classification.
Can ties matter?
Yes, especially with small or discrete datasets, so the rule should be explicit.
Check your understanding
what table shape is used for three groups?
Answer: two rows by three columns.
does a small p-value quantify the size of the median difference?
Answer: no; report descriptive differences and suitable uncertainty separately.
should paired observations be treated as independent groups?
Answer: no, their dependence requires an appropriate design and analysis.
Related terms
- Median
- Contingency table
- Chi-square test
- Continuity correction
- Sign test
- Nonparametric statistics
- Independent samples
- Statistical power
Learn next
Next, compare the median test with rank-based procedures and direct inference for quantiles. Study how ties, dependence, and sample size influence the interpretation of nonparametric tests.
More in Statistics and probability
- Measurement model - A measurement model describes how observations, corrections, and other relevant quantities relate to the quantity being measured.
- Measures of central tendency (center or central location) - Measures of central tendency, also called measures of center or central location, are summaries intended to represent a typical or central value of a...
- Median absolute error - Median absolute error is a prediction-error measure obtained by taking the median of the absolute differences between actual values and their corresponding...
- Mediation (statistics) - Mediation in statistics concerns an intermediate variable through which an exposure or intervention may affect an outcome.
- Mendelian randomization - Mendelian randomization, or MR, uses genetic variants as instrumental variables to investigate whether an exposure has a causal effect on an outcome.
- Mesokurtic - Mesokurtic describes a distribution whose kurtosis equals the normal distribution's benchmark: Pearson kurtosis of three, or excess kurtosis of zero.
Sources
SciPy, median_test documentation and referenced methodology: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.median_test.html NIST/SEMATECH, Measures of Location: https://www.itl.nist.gov/div898/handbook/eda/section3/eda351.htm
Previous: Median filter Next: Median-threshold bitmap (MTB)