Tutorials › Introduction to Statistics › Quartiles by the Median-of-Halves Method

Center, Spread and Position · Tutorial 151 of 996

Quartiles by the Median-of-Halves Method

Use the median-of-halves method to find the first and third quartiles from an ordered data set, including when the sample size is odd or even.

Beginner 9 min read

What You'll Learn

  • Define the first and third quartiles using the median-of-halves method
  • Sort observations and form the correct lower and upper halves
  • Calculate each half’s median when it has an odd or even number of observations
  • Handle ties and check small-sample edge cases
  • Explain why the overall median is excluded when the sample size is odd

Why Quartiles Need a Consistent Rule

The median identifies the middle of an ordered data set. Quartiles extend that idea: the first quartile marks the middle of the lower part of the data, and the third quartile marks the middle of the upper part. To calculate them, we must first decide exactly which observations belong to each part. This tutorial uses the median-of-halves method: sort the observations, divide them into lower and upper halves, and take the median of each half.

The method is straightforward once the halves are formed correctly. The main detail is what to do when the full data set has an odd number of observations. In that case, the overall median is left out of both halves. For an even-sized data set, the observations divide into two equal halves without leaving a single middle observation between them.

Definition: To find the first quartile \(Q_1\) and third quartile \(Q_3\) by the median-of-halves method, first arrange all \(n\) observations in nondecreasing order. Find the median of the lower half; that is \(Q_1\). Find the median of the upper half; that is \(Q_3\). If \(n\) is odd, exclude the overall median from both halves. If \(n\) is even, split the ordered observations into two equal halves.

A Step-by-Step Calculation

Use the following sequence for any data set with at least two observations. The ordering is essential: the halves are formed by the observations’ positions in the ordered list, not by their original order or by the size of the gaps between their values.

1
Order the observations.
Write the data from smallest to largest. Repeated values remain in the list and each counts as an observation.
2
Split the ordered list.
If \(n\) is even, place the first \(n/2\) observations in the lower half and the last \(n/2\) in the upper half. If \(n\) is odd, set aside the overall median and use the observations below it for the lower half and above it for the upper half.
3
Find each half’s median.
The lower-half median is \(Q_1\); the upper-half median is \(Q_3\). If a half has an even number of observations, average its two middle values.

For clarity, write the ordered observations as \(x_{(1)},x_{(2)},\ldots,x_{(n)}\), where \(x_{(1)}\) is the smallest and \(x_{(n)}\) the largest. When \(n=2m\), each half contains \(m\) observations. The lower half consists of \(x_{(1)},\ldots,x_{(m)}\), and the upper half consists of \(x_{(m+1)},\ldots,x_{(2m)}\). When \(n=2m+1\), with \(m\geq 1\), the overall median is \(x_{(m+1)}\); the lower half is \(x_{(1)},\ldots,x_{(m)}\), and the upper half is \(x_{(m+2)},\ldots,x_{(2m+1)}\).

Median rule used within each half: For an ordered half with an odd number of observations, its median is its single middle observation. For an ordered half with an even number of observations, its median is the arithmetic mean of its two middle observations.

Worked Examples

Worked Example: Quartiles for an Even-Sized Data Set

A hypothetical group of eight packages has recorded masses, in grams, of \(15, 4, 22, 9, 18, 6, 12,\) and \(7\). Find \(Q_1\) and \(Q_3\) by the median-of-halves method.

Order the observations: \(4, 6, 7, 9, 12, 15, 18, 22\). Here \(n=8\), so split the list into two groups of four:

$$ \text{Lower half: }4,6,7,9 \qquad \text{Upper half: }12,15,18,22 $$

Each half has an even number of observations, so take the mean of its two middle values. In the lower half those values are \(6\) and \(7\); in the upper half they are \(15\) and \(18\).

$$ Q_1=\frac{6+7}{2}=6.5\text{ g} \qquad Q_3=\frac{15+18}{2}=16.5\text{ g} $$

By this method, the first quartile is \(6.5\) g and the third quartile is \(16.5\) g. The units remain grams because the quartiles are values on the original measurement scale.

Worked Example: Quartiles for an Odd-Sized Data Set

A hypothetical set of nine waiting times, in minutes, is \(14, 3, 20, 8, 26, 12, 5, 17,\) and \(10\). Find both quartiles using the median-of-halves method.

Order the observations: \(3, 5, 8, 10, 12, 14, 17, 20, 26\). Since \(n=9\), the fifth observation, \(12\), is the overall median. Exclude it from both halves:

$$ \text{Lower half: }3,5,8,10 \qquad \text{Overall median: }12 \qquad \text{Upper half: }14,17,20,26 $$

Both halves contain four observations, so each half’s median is the mean of its two middle values. For the lower half, these values are \(5\) and \(8\); for the upper half, they are \(17\) and \(20\).

$$ Q_1=\frac{5+8}{2}=6.5\text{ min} \qquad Q_3=\frac{17+20}{2}=18.5\text{ min} $$

Thus \(Q_1=6.5\) minutes and \(Q_3=18.5\) minutes. The value \(12\) was not included in either quartile calculation because it was the overall median.

Worked Example: Odd Number of Observations and Repeated Values

A hypothetical data set contains seven daily counts: \(8, 2, 14, 2, 11, 5,\) and \(2\). Find \(Q_1\) and \(Q_3\).

Order the observations: \(2, 2, 2, 5, 8, 11, 14\). The overall median is the fourth observation, \(5\). Excluding it leaves three observations in each half:

$$ \text{Lower half: }2,2,2 \qquad \text{Upper half: }8,11,14 $$

Each half has three observations, so its median is its middle observation. The middle value of the lower half is \(2\), and the middle value of the upper half is \(11\). Therefore,

$$ Q_1=2\text{ counts} \qquad Q_3=11\text{ counts} $$

The repeated \(2\)s are all retained: each is a recorded observation and occupies its own position in the ordered list. The method does not remove duplicates.

Why the Odd-Sample Rule Works

The division into halves follows the positions of observations around the center of the ordered data. For \(n=2m\), there are \(m\) observations on each side of the division between positions \(m\) and \(m+1\). For \(n=2m+1\), there are \(m\) observations below the central position \(m+1\) and \(m\) above it. Setting aside the overall median leaves the same number of observations in the lower and upper halves.

The quartiles are then the centers of those halves. This can be checked by looking at the middle positions within each half. For example, with \(n=2m+1\) and \(m\geq1\), the lower half contains exactly positions \(1\) through \(m\), while the upper half contains positions \(m+2\) through \(2m+1\). Taking each half’s median therefore locates its center without reusing the overall median.

If a half has an even number of observations, there is no single observation exactly in its center. Averaging the two central values gives the median of that half, following the same even-sized median rule. This is why a quartile can fall between two observed values, as in the first two examples.

Small Samples and Checks

The procedure requires care at the smallest sample sizes. With two observations, the lower and upper halves each contain one observation, so \(Q_1\) is the smaller value and \(Q_3\) is the larger value. With three observations, excluding the overall median leaves one observation in each half; those two remaining values are \(Q_1\) and \(Q_3\).

With one observation, the overall median is the only observation. Excluding it leaves two empty halves, and an empty set has no median. Therefore, the median-of-halves method does not define \(Q_1\) or \(Q_3\) for a one-observation data set. Do not apply the odd-sample rule with \(m=0\); that would ask for the medians of empty halves.

After calculating, check that the data were sorted, each observation was assigned correctly, and the quartiles lie in the original units. In a nondecreasing ordered list, the resulting values should satisfy \(Q_1\leq Q_3\). If this check fails, revisit the ordering and the halves before changing any calculations.

Common Mistake: Keeping the Overall Median in Both Halves

A frequent error for odd-sized data is to put the overall median into both the lower and upper halves. For the nine waiting times above, that would make the lower group \(3,5,8,10,12\) and the upper group \(12,14,17,20,26\). This does not follow the median-of-halves method because the overall median has been counted in both groups. The correction is to set aside \(12\), leaving \(3,5,8,10\) and \(14,17,20,26\).

Another error is to split the original, unsorted list by its first and last entries or to discard repeated values. Quartiles depend on the ordered positions of all observations. Sort first, keep every recorded value, and then form the halves.

Key takeaway: Sort the data before splitting them. For even \(n\), use the first and last \(n/2\) observations as the two halves. For odd \(n\), exclude the overall median and use the observations on either side. The median of the lower half is \(Q_1\); the median of the upper half is \(Q_3\). For \(n=1\), this method leaves empty halves and does not define quartiles.

Check Your Understanding

Use the median-of-halves method for each question. Keep all observations, including ties.

  1. For the ordered data \(2, 4, 6, 8, 10, 12\), identify the lower and upper halves and calculate \(Q_1\) and \(Q_3\).
  2. For the ordered data \(1, 3, 5, 7, 9, 11, 13\), which observation is excluded from the halves? Calculate both quartiles.
  3. A learner sorts \(2, 6, 2, 9, 4\) as \(2, 2, 4, 6, 9\), then uses \(2,2,4\) as the lower half and \(4,6,9\) as the upper half. What is wrong with this split?
  4. What quartiles does the median-of-halves method give for the two observations \(5\) and \(13\)?
  5. Why does this method not define quartiles for a data set containing only one observation?