When you’re working with data – whether it’s pollutant concentration levels across cities, species counts in a forest, or household income figures – you often need a single number to represent the “centre” of your dataset. That’s where the median comes in. It’s one of the most reliable measures of central tendency, especially when your data isn’t perfectly balanced. In this guide, we’ll break down what the median is, how to calculate it for different types of data, and when it’s a better choice than the mean.
Table of Contents
- What is the median?
- Why is the median important?
- Calculating the median for different data types
- Median for ungrouped data
- Median for discrete frequency distributions
- Median for continuous (grouped) data
- Key properties of the median
- Median vs. mean: when to use which
- When the distribution is symmetrical
- When the distribution is skewed
- When there are outliers
- When to stick with the mean
- Practical tips for working with the median
- The median in environmental research
What is the median?
The median is the middle value that divides a dataset into two equal halves when the values are arranged in ascending or descending order. Fifty percent of observations fall at or below the median, and fifty percent fall at or above it. In simple terms, it tells you the point where half your data sits on one side and the other half sits on the opposite side.
Because of this property, the median is also referred to as the 50th percentile. It’s sometimes called a positional average because its value depends entirely on the position of data points, not on their actual numerical magnitude. This makes it fundamentally different from the mean, which takes every value into account when computing the result.
Why is the median important?
The median plays a critical role in descriptive statistics because it gives you a stable centre point that isn’t easily distorted. In environmental research, for example, you might be measuring air quality index (AQI) readings across 30 days. If a couple of days had extreme pollution spikes (say, during Diwali or a wildfire event), those outliers would drag the mean upward and misrepresent the typical air quality. The median, however, would remain anchored near the true middle of your dataset.
As the Australian Bureau of Statistics explains, the median is usually the preferred measure of central tendency when a distribution is not symmetrical, because it remains unaffected by extreme values in the tails of the distribution.
Calculating the median for different data types
The way you find the median depends on how your data is organized. Let’s walk through three scenarios: ungrouped data, discrete frequency distributions, and continuous (grouped) frequency distributions.
Median for ungrouped data
Ungrouped data is simply a raw list of individual values – no classes, no frequency table. Finding the median here is straightforward.
Step 1: Arrange the data in ascending (or descending) order.
Step 2: Find the position of the median using the number of observations (n).
If n is odd, the median is the value at position (n + 1) / 2. If n is even, the median is the average of the n/2th and (n/2 + 1)th values.
Example (odd n): Suppose you recorded daily rainfall (in mm) over 7 days: 12, 5, 8, 20, 3, 15, 10. First, arrange in order: 3, 5, 8, 10, 12, 15, 20. Here, n = 7, so the median is at position (7 + 1) / 2 = 4th value. The median is 10 mm.
Example (even n): Now suppose you have 8 readings: 3, 5, 8, 10, 12, 15, 18, 20. Here, n = 8, so the median is the average of the 4th and 5th values: (10 + 12) / 2 = 11 mm.
Median for discrete frequency distributions
A discrete frequency distribution lists distinct values alongside how often each value occurs. This is common when working with count data – for instance, the number of bird species spotted at different observation sites.
Step 1: Prepare a cumulative frequency column. Starting from the first value, keep adding each frequency to the running total.
Step 2: Find the median position using (n + 1) / 2, where n is the total frequency.
Step 3: Locate the value whose cumulative frequency first equals or exceeds the median position. That value is your median.
Example: In a study of daily noise pollution complaints received by a municipal office over 30 days, the data looks like this:
Complaints per day: 0 (frequency 4), 1 (frequency 6), 2 (frequency 8), 3 (frequency 7), 4 (frequency 5). Total n = 30.
Cumulative frequencies: 0 โ 4, 1 โ 10, 2 โ 18, 3 โ 25, 4 โ 30.
Median position = (30 + 1) / 2 = 15.5th observation. Looking at the cumulative frequency column, the 15.5th observation falls in the value 2 (since cumulative frequency reaches 18 at this point, which is the first to cross 15.5). The median number of daily complaints is 2.
Median for continuous (grouped) data
When data is grouped into class intervals – such as temperature ranges, income brackets, or pollution concentration bands – you cannot identify exact individual values. Instead, you estimate the median using a formula based on interpolation within the median class.
The formula is:
Median = l + [(n/2 โ c) / f] ร h
Where:
l = lower boundary of the median class
n = total number of observations (sum of all frequencies)
c = cumulative frequency of the class preceding the median class
f = frequency of the median class
h = width (size) of the median class interval
How to identify the median class: Calculate n/2. Then look at your cumulative frequency column and find the first class whose cumulative frequency is equal to or greater than n/2. That class is your median class.
Example: Suppose you’re studying the distribution of dissolved oxygen (DO) levels (in mg/L) in 50 water samples from a river:
DO level 2-4: frequency 5 | DO level 4-6: frequency 10 | DO level 6-8: frequency 18 | DO level 8-10: frequency 12 | DO level 10-12: frequency 5
First, build the cumulative frequency: 2-4 โ 5, 4-6 โ 15, 6-8 โ 33, 8-10 โ 45, 10-12 โ 50.
Total n = 50, so n/2 = 25. The first cumulative frequency โฅ 25 is 33, corresponding to the class 6-8. This is your median class.
Now apply the formula: l = 6, n/2 = 25, c = 15, f = 18, h = 2.
Median = 6 + [(25 โ 15) / 18] ร 2 = 6 + (10/18) ร 2 = 6 + 1.11 = 7.11 mg/L
This tells you that approximately half the water samples had DO levels below 7.11 mg/L and the other half had levels above it – a useful data point for assessing water quality conditions in that stretch of the river.
Key properties of the median
Understanding the median’s properties helps you know when to rely on it and when to consider other measures.
Resistant to outliers: Unlike the mean, the median is not pulled by extreme values. Whether the largest value in your dataset is 100 or 10,000, the median stays the same as long as it remains in the middle position.
Works with ordinal data: You can calculate a median for ordinal data (e.g., survey responses ranked as low, medium, high), whereas the mean requires interval or ratio-level data. According to a peer-reviewed paper in the Journal of Pharmacology & Pharmacotherapeutics, the median can be determined for ratio, interval, and ordinal scales, making it versatile across many research scenarios.
Does not use all values: The median only depends on the middle value(s), not on the magnitude of every observation. This is both a strength (resistance to outliers) and a limitation (it ignores potentially useful information from the dataset’s spread).
Not easily combined: If you calculate the median of two separate groups, you cannot simply combine them to find the median of the pooled group. The mean, by contrast, can be pooled algebraically when you know the group sizes.
Median vs. mean: when to use which
Both the median and the mean are measures of central tendency, but they perform differently depending on the shape of your data distribution. Knowing when each one is more appropriate is essential for accurate analysis.
When the distribution is symmetrical
In a perfectly symmetrical (normal) distribution, the mean, median, and mode all coincide at the same point. In this scenario, the mean is generally preferred because it incorporates every data point in its calculation, giving a more complete summary. As the Australian Bureau of Statistics notes, in symmetrical distributions all three measures describe the centre equally well, but the mean is favoured because it uses all available information.
When the distribution is skewed
This is where the median shines. In a skewed distribution, extreme values in one tail pull the mean away from the centre, making it a poor representation of the “typical” value. The median, however, stays put near the centre regardless of how long or heavy the tails are.
Consider the classic example of income data. In most countries, a small number of very high earners drag the mean income well above what most people actually earn. The median income provides a far more realistic picture of what a typical household earns, because it represents the exact midpoint – half the population earns more, and half earns less.
In environmental science, similar skewness appears frequently. Pollution concentration data, species abundance counts, and flood discharge volumes often exhibit right-skewed distributions where a few very high values inflate the mean. In such cases, reporting the median gives a more honest representation of typical conditions.
When there are outliers
Outliers – data points that are unusually high or low compared to the rest – can dramatically affect the mean. As one educational resource puts it, outliers distort the mean to the point where it no longer accurately represents the dataset. The median remains stable, making it the better choice when you suspect your data contains measurement errors, anomalous readings, or naturally occurring extreme values.
For instance, if you’re measuring soil pH across 20 sampling sites and one site has an anomalous reading of 2.1 due to a nearby chemical spill while the rest range between 5.5 and 7.5, the mean pH would drop noticeably. The median would barely change.
When to stick with the mean
The mean is still the most widely used measure of central tendency, and for good reason. It’s algebraically defined, which makes it useful in further statistical calculations like standard deviation, t-tests, and regression analysis. When your data is roughly symmetrical and free of extreme outliers, the mean provides a comprehensive summary that accounts for every observation.
Practical tips for working with the median
Here are a few things to keep in mind when using the median in your research or coursework:
Always sort your data first. The most common mistake when finding the median is forgetting to arrange values in order. An unsorted dataset will give you the wrong middle value.
Check whether your data is grouped or ungrouped. The method for calculating the median differs significantly. For raw data, it’s a simple positional approach. For grouped data, you need the interpolation formula.
Report both the median and the mean when possible. Presenting both gives your audience a clearer picture. If the two values are close, the distribution is likely symmetrical. If they diverge, there’s likely skewness, and the median may be the more representative measure.
Use cumulative frequency curves (ogives). For grouped data, plotting an ogive lets you visually estimate the median by drawing a horizontal line at the n/2 level and reading the corresponding value on the x-axis. This is a quick graphical check that complements your formula-based calculation.
The median in environmental research
In environmental science, the median is used more often than many students realize. Regulatory agencies frequently report median pollutant concentrations rather than means because environmental data almost always contains some extreme readings. Water quality standards, air quality reports, and biodiversity indices often rely on median values to set benchmarks and evaluate compliance.
For example, when the quality of river water is assessed across multiple sampling points, median values for parameters like dissolved oxygen, biochemical oxygen demand, and turbidity provide a more dependable baseline than mean values. Similarly, when studying species abundance across different habitats, the median count captures what a “typical” site looks like without letting a single extraordinarily rich or poor site distort the picture.
Understanding how to correctly calculate and interpret the median is therefore not just a statistical exercise – it’s a practical skill that strengthens the quality and credibility of environmental research.
What do you think? In your own field of study or everyday life, can you think of a situation where using the mean might give a misleading result, and the median would provide a clearer picture? How might the choice between median and mean affect the conclusions of an environmental impact assessment?
References
- https://pmc.ncbi.nlm.nih.gov/articles/PMC3157145/
- https://www.abs.gov.au/statistics/understanding-statistics/statistical-terms-and-concepts/measures-central-tendency
- https://stats.libretexts.org/Courses/City_University_of_New_York/Introductory_Statistics_with_Probability_(CUNY)/02:_Descriptive_Statistics/2.04:_Measures_of_Central_Tendency-_Mean_Median_and_Mode
- https://www.geeksforgeeks.org/maths/median-of-grouped-data/
- https://www.scribbr.com/statistics/central-tendency/
- https://statistics.laerd.com/statistical-guides/measures-central-tendency-mean-mode-median.php
- https://www.riosalado.edu/web/oer/WRKDEV100-20011_INTER_0000_v1/lessons/Mod05_MeanMedianMode.shtml
Leave a Reply