Why Software May Report a Value Not in the Data
A percentile describes a position in an ordered distribution. If a percentile's position falls between two observations, a software program may estimate its value by interpolating between them. The calculation is systematic, but it does not make the result an observation that was actually recorded.
There is more than one convention for calculating percentiles. The method taught here is a common linear interpolation rule, often called the inclusive method or type 7. It is used by many software tools, but it is not universal. When an exact percentile value matters, identify the convention the software uses rather than assuming all programs return the same number.
Calculating the Interpolated Value
The rank position \(h\) may be a whole number or have a fractional part. Write \(j=\lfloor h \rfloor\), the greatest integer less than or equal to \(h\), and let \(\gamma=h-j\). If \(h\) is not an integer, then \(x_{(j)}\) and \(x_{(j+1)}\) are the adjacent observations surrounding the position. The percentile value is:
Here, \(Q(p)\) denotes the percentile value under this convention. The fraction \(\gamma\) tells how far the position lies from \(x_{(j)}\) toward \(x_{(j+1)}\). For example, if \(\gamma=0.25\), the calculation moves one quarter of the distance from the lower observation to the upper one.
At the endpoints, \(p=0\) gives \(h=1\) and the minimum observation, while \(p=1\) gives \(h=n\) and the maximum observation. When \(h\) is a whole number between these endpoints, use \(Q(p)=x_{(h)}\); there is no need to interpolate.
Write the data in nondecreasing order and label the positions from 1 to \(n\).
For example, the 30th percentile has \(p=0.30\).
Calculate \(h=1+(n-1)p\).
If \(h\) is an integer, take that observation. Otherwise, calculate the weighted average of the two observations around \(h\).
Worked Example: A Percentile Between Observations
In a hypothetical set of four recorded waiting times, the ordered observations are 12, 14, 19, and 25 minutes. Find the 50th percentile using the stated interpolation method.
There are \(n=4\) observations, and the 50th percentile corresponds to \(p=0.50\). Its rank position is:
The position \(2.50\) lies halfway between positions 2 and 3. Thus, \(j=2\), \(\gamma=0.50\), \(x_{(2)}=14\), and \(x_{(3)}=19\). Substituting:
The interpolated 50th-percentile value is 16.5 minutes. It is not one of the four recorded times: the calculation places it halfway between 14 and 19. This is a calculated summary, not a claim that anyone in this hypothetical data set waited exactly 16.5 minutes.
Why the Formula Interpolates
Interpolation here means taking a fraction of the distance between two adjacent values. If the fractional part of the position is \(\gamma\), the distance moved from the lower value is \(\gamma\) times the gap between the values. This gives a direct justification for the weighted-average formula:
Because \(0<\gamma<1\) for a noninteger position, both weights, \(1-\gamma\) and \(\gamma\), are positive and sum to 1. Therefore, the interpolated value lies between the two adjacent observations. If those observations are equal, the interpolated value is equal to them; otherwise, it falls strictly between them. Its numerical value may be absent from the data.
Worked Example: A Fractional Position Near the Lower Observation
Suppose a hypothetical set of six recorded measurements, in their original units, is 4, 7, 9, 13, 18, and 22. Calculate the 25th percentile using linear interpolation.
Here \(n=6\) and \(p=0.25\). The rank position is:
Thus \(j=2\), \(\gamma=0.25\), and the surrounding observations are \(x_{(2)}=7\) and \(x_{(3)}=9\). The percentile value is:
The 25th-percentile value is 7.50 in the measurement units. It is one quarter of the way from 7 to 9, since \(7+0.25(9-7)=7.50\). Neither 7.50 nor any other assertion about unobserved measurements is needed: the calculation only defines a summary by this interpolation convention.
When the Position Is an Integer
A fractional rank position is not guaranteed. When \(h\) is an integer, the specified method selects an observed value directly. In that case there is no gap to divide and no weighted average of two different positions to calculate.
Worked Example: A Percentile at an Observed Position
For five hypothetical quiz scores, the ordered values are 52, 58, 61, 67, and 74 points. Find the 50th percentile using linear interpolation.
With \(n=5\) and \(p=0.50\), the rank position is:
Position 3 is an integer, so the percentile value is the third ordered score:
The 50th-percentile value is 61 points, which is an observed score. This example differs from a fractional-position calculation: the method selects the value at the specified rank rather than creating a value between two ranks.
What the Result Does and Does Not Mean
Interpolation provides a consistent way to return a percentile value even when the calculated rank position is fractional. It is especially convenient for quantitative measurements, where values between recorded measurements may be meaningful on the measurement scale. The returned value is still determined by a rule applied to the observed data; it is not evidence that the value itself occurred.
Care is needed for data that can take only separate values, such as a count of children or a score that must be a whole number. A percentile calculated by interpolation might be 2.4 children or 76.5 points even though those values cannot occur as recorded observations. The result can still be reported as the percentile under the chosen convention, but the analyst should not describe it as an actual member of the data set. Rounding it to a possible value also changes the reported summary and should not be done silently.
The earlier material on percentiles and the nearest-rank rule uses a different convention. Nearest-rank and interpolation methods can return different values for the same data and requested percentile. Neither calculation should be presented as the sole inevitable answer without naming its rule. Software documentation or function settings should be checked when reproducing a result, because programs may use different definitions or offer several options.
Common Mistakes
- Calling an interpolated value an observation. A result such as 16.5 may not occur in the data. Describe it as the percentile value calculated by the specified method, not as a measured value.
- Using the wrong position formula. For this method, the position is \(1+(n-1)p\). Substituting a formula from another convention can give a different answer.
- Confusing a percentile label with its position. The 25th percentile uses \(p=0.25\), not \(p=25\), in the position formula.
- Interpolating when the position is already an integer. If \(h=3\), for example, the method selects \(x_{(3)}\); it does not average positions 3 and 4.
- Forgetting the units. The percentile value is on the same measurement scale as the observations. If the data are minutes, the result is in minutes.
Check Your Understanding
For each question, use the linear interpolation method defined above unless another instruction is given.
- For the ordered observations 3, 8, 10, and 15, calculate the 40th-percentile rank position. Which two observations surround it?
- For the same four observations, calculate the percentile value corresponding to the position in question 1. Show the interpolation.
- For the ordered observations 5, 9, 12, 16, and 20, calculate the 75th percentile. Is the rank position an integer?
- Explain why a percentile value of 11.5 can be a valid result of interpolation even if no observation equals 11.5.
- Why should someone reporting a software percentile state or verify the convention used?