Independent study guide

Grouped-Data Quantiles: Locate the Class Before Interpolating

Read cumulative counts before estimating a median or quartile. Three worked examples and six exercises separate rank, measurement and interpolation assumptions.

Nablio · 6 questionsPublished

1. Count first, estimate second

An effectif is a count; an effectif cumulé is a cumulative count. A class such as [4,10)[4,10), also written [4,10[ in French, includes 4 but excludes 10. A grouped table tells us how many observations lie in each interval, not their individual values. If you start with a frequency-density histogram, recover each count as bar height times class width. Do not add the heights when widths differ.

Assume N>0N>0 and 0<p<10<p<1. For this lesson, define the grouped p-quantile estimate by a continuous model that spreads each class count uniformly across its interval. Its cumulative target is r=pNr=pN, where N is the total count. For quartiles use p=1/4,1/2,3/4p=1/4,1/2,3/4. This convention is not a universal recipe for quantiles of raw observations: raw-data conventions may use different ranks or averages. Follow the convention stated in your course.

Find the first class whose cumulative count C reaches the target. If B is the count before that class, check B<r≤CB<r\le C. This locates a segment of the cumulative model; it does not mean that a fractional rank is an observed measurement. A count such as 22 and a time such as 9.25 minutes answer different questions.

2. Worked example: why the target is in this class

Consider 44 waiting times in minutes, grouped into [0,4),[4,10),[10,20)[0,4),[4,10),[10,20), with counts 8,16,208,16,20. Their cumulative counts are 8,24,448,24,44. In sorted order, observations 1–8 are in the first class, 9–24 in the second, and 25–44 in the third. This rank map comes from the counts alone.

The grouped median target is r=N/2=22r=N/2=22. The first class stops at 8, so it cannot reach 22. The second reaches 24, so it does: 8<22≤248<22\le24. Select the second class before doing any interpolation. For these particular data, both middle raw-data ranks, 22 and 23, also lie in that class; their exact values remain unknown.

Now add the uniform-within-class assumption. Starting at 4 minutes, we need 22−8=1422-8=14 of the class’s 16 counts. That is the fraction 14/1614/16 of its width 10−4=610-4=6. Hence the estimated median is Q^0.5=4+6(14/16)=9.25\widehat Q_{0.5}=4+6(14/16)=9.25 minutes. The fraction is dimensionless; multiplying by the width gives minutes.

In general, let L be the lower boundary, w the class width and f its positive count. Linear interpolation gives Q^p=L+w(pN−B)/f\widehat Q_p=L+w(pN-B)/f. This follows by solving B+f(x−L)/w=pNB+f(x-L)/w=pN for x. The cumulative total is assumed to increase linearly inside each class. Do not substitute the class midpoint unless the required fraction is exactly one half.

3. Worked example: quartiles use different classes

Keep the same 44 observations. For the first quartile, r=N/4=11r=N/4=11, and 8<11≤248<11\le24, so use the second class again. This time only (11−8)/16=3/16(11-8)/16=3/16 of its width is needed. Thus Q^0.25=4+6(3/16)=5.125\widehat Q_{0.25}=4+6(3/16)=5.125 minutes.

For the third quartile, r=3N/4=33r=3N/4=33, and 24<33≤4424<33\le44, so use the third class: Q^0.75=10+10(33−24)/20=14.5\widehat Q_{0.75}=10+10(33-24)/20=14.5 minutes. The estimated interquartile range is 14.5−5.125=9.37514.5-5.125=9.375 minutes. Subtract quantile values, not cumulative counts. The two quartiles need their own L, B, f and w.

4. Worked example: a boundary is not the raw median

Now take two classes [0,10),[10,20)[0,10),[10,20), each containing 4 observations. The target is N/2=4N/2=4, exactly a cumulative boundary. Under the grouped model, Q^0.5=0+10(4/4)=10\widehat Q_{0.5}=0+10(4/4)=10. This is the endpoint reached by the interpolation, even though the first class excludes 10. There is no contradiction: the model spreads continuous mass, rather than claiming that observation 4 equals 10.

Compare two possible ordered raw data sets: 1,2,3,4,10,11,12,131,2,3,4,10,11,12,13 and 6,7,8,9,16,17,18,196,7,8,9,16,17,18,19. Both produce exactly the same grouped counts. Using the usual even-sample median, their medians are (4+10)/2=7(4+10)/2=7 and (9+16)/2=12.5(9+16)/2=12.5. The grouped estimate 10 cannot recover either exact raw median from the counts alone.

At a cumulative boundary, state the boundary estimate instead of asserting that the raw median belongs to one class. If a class is empty, never divide by its zero count. At a flat cumulative segment, the first-reaching convention used here selects its left endpoint; other conventions must be stated explicitly. If the selected class is unbounded, for example [20,∞)[20,\infty), it has no finite width: this interpolation does not apply.

5. Six graduated exercises

1. Locate before calculating

Classes [0,5),[5,10),[10,20)[0,5),[5,10),[10,20) contain 4,6,164,6,16 observations. Find the cumulative counts and select the class for the grouped median target. Do not interpolate yet.

Hint

Write the rank range covered by each class.

Explained solution

The total is N=26N=26, and the cumulative counts are 4,10,264,10,26. The target is 1313. Since 10<13≤2610<13\le26, select [10,20)[10,20), which contains ranks 11–26. A target rank of 13 is not a measured value of 13.

2. A fractional target

Use the same table to estimate the first quartile with the stated uniform model.

Hint

A target of 6.5 is a location on the cumulative scale, not half an observation.

Explained solution

r=26/4=6.5r=26/4=6.5, and 4<6.5≤104<6.5\le10, so use [5,10)[5,10). The fraction is (6.5−4)/6=5/12(6.5-4)/6=5/12, giving Q^0.25=5+5(5/12)=85/12≈7.083\widehat Q_{0.25}=5+5(5/12)=85/12\approx7.083. Do not round the target before interpolation.

3. Finish the median estimate

For the same table, estimate the median and explain what remains unknown.

Hint

Use the third class’s width, not the width of the first two.

Explained solution

Q^0.5=10+10(13−10)/16=11.875\widehat Q_{0.5}=10+10(13-10)/16=11.875. The estimate assumes uniform distribution within the class. The actual observations at ranks 13 and 14 are unknown, so their average, the usual raw-data median, is not determined.

4. Recover counts from density

A frequency-density histogram has classes [0,2),[2,8),[8,12)[0,2),[2,8),[8,12) and heights 3,2,13,2,1 observations per unit. Estimate the grouped median.

Hint

Convert areas to counts before adding anything.

Explained solution

The counts are 2(3)=6,6(2)=12,4(1)=42(3)=6,6(2)=12,4(1)=4, so N=22N=22 and cumulative counts are 6,18,226,18,22. The target 1111 satisfies 6<11≤186<11\le18. Therefore Q^0.5=2+6(11−6)/12=4.5\widehat Q_{0.5}=2+6(11-6)/12=4.5. Heights alone would give the wrong total.

5. Recognize a boundary

Classes [0,4),[4,8),[8,12)[0,4),[4,8),[8,12) have counts 5,5,105,5,10. Find the grouped median estimate. Is it necessarily the exact raw median?

Hint

The target equals a cumulative count.

Explained solution

N=20N=20 and r=10r=10. The cumulative counts are 5,10,205,10,20, so interpolation reaches 4+4(10−5)/5=84+4(10-5)/5=8. This is a model boundary estimate. Raw ranks 10 and 11 lie on opposite sides of the boundary, so their average need not equal 8.

6. Know when to stop

Classes [0,10),[10,20),[20,∞)[0,10),[10,20),[20,\infty) have counts 4,5,114,5,11. Can you give a finite grouped-median interpolation? What can you say about the usual raw median?

Hint

You know the selected class but not its width.

Explained solution

N=20N=20, r=10r=10, and cumulative counts are 4,9,204,9,20. The target is in the last class, but its width is unspecified. No finite linear interpolation follows from this table. Ranks 10 and 11 are both at least 20, so the usual raw median is at least 20, with no finite upper bound supplied by the table.

6. Final check

Check counts, then cumulative totals, the target, the class and finally the units. Always separate what the table establishes from what the uniform model estimates. This original lesson makes no course or exam claim. References and prerequisites: NIST: grouped quantiles; actuar: quantiles of grouped data; histograms and frequency density.

Useful for

Work on the step you’re missing.

Tell us the subject and your preferred time. Nablio confirms the details by text or email.

Request a lesson