ADDRESS AND STATISTICAL CHECKS

Checking a percentile after a positive linear conversion

If every value in a list is multiplied by a positive factor and shifted by a constant, each percentile moves by the same rule. This guide shows why, checks it with the Percentile Calculator and explains where the shortcut stops working.

A shortcut for changing units

Suppose you have a list of measurements and need a percentile of the same data in a different unit. You could convert every value and then find the percentile again. For a large list that is tedious. When the unit change is linear and the scale factor is positive, there is a shortcut: find the percentile in the original unit, then apply the same conversion to that single number. Temperatures converted from Celsius to Fahrenheit, lengths from meters to centimeters, and scores rescaled by a constant all qualify. The shortcut works because a positive linear change keeps the values in the same rank order, so the same position in the sorted list still holds the same observation. This guide demonstrates the idea with a small list and checks it with the Percentile Calculator, which interpolates between neighboring values.

How this calculator finds a percentile

The Percentile Calculator uses the method often called Type 7 in the classification by Rob Hyndman and Yanan Fan, published in 1996. It is the default in the R language and matches the PERCENTILE.INC function in Excel. For a sorted list of n values and a percentile p given as a fraction, the position is 1 plus n minus 1 times p. The integer part names a value, and the fractional part says how far to move toward the next value. For four values and the 25th percentile, the position is 1 plus 3 times 0.25, which is 1.75. That lies three quarters of the way from the first value to the second. Different software uses other definitions that can give slightly different answers, so the convention should be stated whenever a percentile is reported.

The original list

Take the values 0, 10, 20 and 30 and ask for the 25th percentile. They are already sorted. The position is 1.75, so the percentile lies three quarters of the way between the first value, 0, and the second, 10. That is 0 plus 0.75 times 10, which is 7.5. The calculator returns 7.5, and notice that it is not a value in the list. Interpolated percentiles often fall between observations, which is a feature of the method and not an error. If the list were treated as only the four exact values, the 25th percentile would be ambiguous, since 25 percent of four items is exactly one item, and different conventions would give 0, 10 or something between. The interpolation resolves that ambiguity by a fixed rule, and the same rule is applied to the transformed list.

Applying the linear change

Now multiply every value by 2 and add 5. The list becomes 5, 25, 45 and 65. The 25th percentile has the same position, 1.75, so it lies three quarters of the way from 5 to 25. The gap is 20, three quarters of which is 15, so the percentile is 5 plus 15, or 20. The Percentile Calculator returns 20. Now apply the same linear rule to the original answer: 2 times 7.5 plus 5 is 20. The two routes agree. The reason is that interpolation is itself a linear combination of two neighboring values, and a linear change passes through such a combination unchanged. Written out, the percentile is value one plus 0.75 times the gap, and doubling the values doubles the gap, while adding 5 shifts both values equally and leaves the gap alone.

A realistic example with temperatures

Convert temperatures with F equals 1.8 times C plus 32, which is a positive linear change. Take the daily highs 10, 15, 20 and 25 degrees Celsius and ask for the 75th percentile. The position is 1 plus 3 times 0.75, which is 3.25, one quarter of the way from 20 to 25. That is 20 plus 1.25, or 21.25 degrees Celsius. Converting that to Fahrenheit gives 1.8 times 21.25 plus 32, which is 38.25 plus 32, or 70.25. Converting the list first gives 50, 59, 68 and 77, whose 75th percentile is 68 plus a quarter of the 9-degree gap, or 70.25. The routes match. The example values are illustrative. Note that the Celsius to Fahrenheit change has a positive slope of 1.8, which is the only condition the shortcut needs on the scale.

Why order must be preserved

A percentile is defined by rank, so the argument depends on the transformation keeping the ranks the same. Any increasing function does that, for example the logarithm or the square root, but only linear ones also carry the interpolated value through correctly. For a nonlinear increasing function, the percentile of the transformed data is the transform of the percentile only when the percentile lands exactly on an observation. When interpolation is involved, the average of two transformed values is not the transform of the average. For example, the square root of the midpoint between 4 and 16, which is 10, is about 3.16, while the midpoint of the square roots 2 and 4 is 3. So the shortcut is a property of linear changes in particular, and it should not be assumed for logarithms, powers or other curves.

When the scale factor is negative

Multiplying by a negative number reverses the order of the list, so the low end becomes the high end. The 25th percentile of the transformed data then corresponds to the 75th percentile of the original, with the transformation applied. Take the values 0, 10, 20 and 30 and multiply by negative one. The sorted list is negative 30, negative 20, negative 10 and 0, and its 25th percentile is negative 30 plus 0.75 times 10, which is negative 22.5. That equals negative one times the original 75th percentile of 22.5, not negative one times the original 25th percentile of 7.5. Applying the positive-scale shortcut here would give negative 7.5, which is wrong. For negative factors, swap the percentile to 100 minus p before applying the rule. A subtraction from a constant, such as 100 minus the score, is a negative scale and needs this care.

What the shortcut is good for

The practical value is in reporting and in checking. If a dataset is published in one unit and you need a summary in another, you can transform the summary numbers directly, including the median, quartiles and any percentile, as long as the conversion is increasing and linear. It also gives a quick test for software or spreadsheets: convert the list, recompute, and compare with the converted percentile. A mismatch points to a sorting problem, a different percentile method used on the two lists, or rounding done too early. The same property holds for the mean, which also follows a linear change. The standard deviation does not shift with the constant but does scale by the absolute value of the factor, so adding 5 leaves it unchanged and multiplying by 2 doubles it.

Limits of the example

The identity requires the same percentile method on both lists. If one list is processed with Type 7 and the other with a nearest-rank rule, the numbers can differ even for a positive linear change, and the mismatch has nothing to do with the transformation. The example also uses four values, which is far too few for a reliable percentile estimate of a real population. In small samples the 25th percentile moves a lot when one value changes. The worksheet demonstrates the arithmetic relationship and does not recommend a percentile convention for any application. Choose the method that your field, your software or your standard specifies, and document it with the result. The linear relationship then holds within that method, whatever the data are. Because the identity concerns positions in a sorted list, it also holds for any p, so you can test it at the median, the quartiles or the 90th percentile of the same list. If the transformed percentile fails to match for one p but not others, check that the list was fully sorted and that no value was dropped or duplicated during the conversion. Matching at every p is stronger evidence than matching at a single p.

Checking the rule with a longer list

A longer example helps show the same rule when the position falls between several values. Take the list 12, 18, 30, 40 and 55, with n equal to 5. The 90th percentile has position 1 plus 4 times 0.9, which is 4.6, so it lies six tenths of the way from the fourth value, 40, to the fifth, 55. That gap is 15, and 0.6 times 15 is 9, so the percentile is 49. Now apply the linear change of tripling and subtracting 10: the list becomes 26, 44, 80, 110 and 155. The 90th percentile is 110 plus 0.6 times 45, which is 137. Applying the rule to the original answer gives 3 times 49 minus 10, which is 137. Same result. The positions are identical in both lists because they depend only on n and p, not on the values themselves, which is why the rule holds for any list with the same count.

Practical uses and a few pitfalls

One use is reporting the same dataset to audiences who use different units without recomputing everything. Another is a check on a spreadsheet: if a converted column gives a percentile that does not match the converted percentile, a formula is probably referencing the wrong range. Watch for three pitfalls. First, rounding the converted values before finding the percentile can shift interpolated results slightly, so keep full precision until the end. Second, a conversion with a positive scale but a large offset, such as adding 1,000, is fine mathematically, but floating-point arithmetic may show tiny differences in the last digits. Third, scores that are capped or censored, for example at 100, no longer follow a pure linear change once values are clipped, so the shortcut should be used only on the unclipped data.

Reproduce the checks

Original percentile

Open the Percentile Calculator and enter:

Numbers
0,10,20,30
Percentile
25

Expected output:

Value

7.5

The interpolation position lies between the first two sorted values.

Converted percentile

Open the Percentile Calculator and enter:

Numbers
5,25,45,65
Percentile
25

Expected output:

Value

20

The positive linear transformation carries through the percentile.

References and implementation scope

The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.

Sources

Related tasks