Skip to content
Glacius
StatisticsConcept reference

Sample quantiles

A sample quantile is a value located in ordered observations according to a specified quantile convention.

On this page 7 sections
  1. Overview
  2. A sample quantile locates a position in ordered observations
  3. Round upward even when the decimal part is small: 2.1 gives rank 3
  4. Different conventions can give different answers
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01A sample quantile locates a position in ordered observations#

A sample quantile locates a position in ordered observations. The answer depends on the convention. This lesson uses nearest rank: for 0<p10<p\leq1, sort, multiply pp by the count nn, and round upward to a whole position.

For 1,3,6,9,121,3,6,9,12 and p=0.6p=0.6, the rank is 0.6×5=30.6\times5=3. Read the third value, 66.

Five ordered values 1,3,6,9,12 have ranks 1 through 5. The third value 6 is highlighted. For p=0.6, pn=3, so the nearest-rank quantile is 6. Equal spacing indicates rank, not numerical distance.Five ordered values 1,3,6,9,12 have ranks 1 through 5. The third value 6 is highlighted. For p=0.6, pn=3, so the nearest-rank quantile is 6. Equal spacing indicates rank, not numerical distance.
Figure 1Five ordered values 1,3,6,9,12 have ranks 1 through 5. The third value 6 is highlighted. For p=0.6, pn=3, so the nearest-rank quantile is 6. Equal spacing indicates rank, not numerical distance.
Link to this figure ↗Download SVGDownload PNG
Check your reasoning

Rule: sort; take rank pn rounded up. Sample: 7, 2, 10, 5, 12. p=0.7. Quantile?

Show answer and explanation
10

Rank 4; sorted value 10.

02Round upward even when the decimal part is small: 2.1 gives rank 3#

Round upward even when the decimal part is small: 2.12.1 gives rank 33. An exact rank such as 22 stays 22. At p=1p=1, this rule selects the largest observation.

Counts include repeats. If 22 occurs twice and 99 three times, the ordered list is 2,2,9,9,92,2,9,9,9. With p=0.4p=0.4, rank 22 gives value 22.

Check your reasoning

Rule: sort; take rank pn rounded up. Counts: 3 occurs 3 times; 8 occurs 2 times. p=0.8. Quantile?

Show answer and explanation
8

5 observations; rank 4 gives 8.

03Different conventions can give different answers#

Different conventions can give different answers. At p=0.5p=0.5 for 2,6,10,142,6,10,14, nearest rank selects 66. The usual even-size median averages 66 and 1010 to get 88.

Check your reasoning

Rule: sort; take rank pn rounded up. Sample: 0, 4, 6, 12. p=0.5. “Average middle values: 5.” Repair.

  1. A5
  2. B4
  3. C2
Show answer and explanation
4

Rank 2 gives 4.

Key takeaway

Sort and follow the supplied rank rule. Under nearest rank, round pn upward and read that observation; another convention may give another answer.

  • Locate a quantile under its stated rule.

Sources & further reading

  1. [1]
  2. [2]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Sample quantiles.” Math behind ML. /learn/s-quantiles