Tables and axes > Statistical functions and totals > Creating percentiles and medians > Interpolation with percentiles
 
Interpolation with percentiles
When you calculate percentiles from numeric variables using inc=, Quantum provides four methods of interpolation for calculating the percentile values. You define the interpolation method to be used with the medint= option on the a, tab or flt statement. When no medint is specified, Quantum assumes the default of medint=0.
The following table is used to illustrate the different types of interpolation.
Base           
Base
20
Value is 1       
5
Value is 2
6
Value is 3
3
Value is 4
3
Value is 5
3
Although the examples illustrate these options for calculating medians, the same principles apply to calculating any other percentile value.
medint=0
Interpolate between the value exceeding the percentile mark and the previous value. This is the default interpolation method.
Using this method of interpolation, the median for the example table is reported as 1.83, which is an interpolation between 1 and 2. The median respondent is the tenth respondent, who gave a response of 2. The value exceeding the median respondent is the response given by the 11th respondent, which is also 2, and the previous value is 1. Six people gave a response of 2 and Quantum assumes that they are evenly spaced between the two interpolation values of 1 and 2; that is, that they are spaced at intervals of 1/6 = 0.16667. The median respondent is the fifth respondent who answered 2. The median is therefore calculated as 5 x 0.16667/1 = 1.83.
medint=1
No interpolation. Quantum reports the exact value which exceeds the percentile mark.
Using this method, the median in the example table is reported as 2.00 because this is the 11th value found.
medint=2
Interpolate between:
the midpoint between the percentile mark and the previous value, and
the midpoint between the percentile mark and the next value
Using this method, the median in the example table is reported as 2.33, which is an interpolation between 1.5 and 2.5.
The median respondent gave a response of 2, so the previous value is 1 and the midpoint between these two values is 1.5. The value after the median respondent’s value is 3, and the midpoint between this and the median respondent’s value of 2 is therefore 2.5. Quantum interpolates between the two midpoint values of 1.5 and 2.5. The difference between them is 1, and Quantum assumes that the six people who gave a response of 2 are evenly spaced at intervals of 1/6 = 0.16667. The median respondent is the fifth respondent who gave the response of 2, so the median is calculated as:
5 x 0.16667 + 1.5 = 2.33
medint=3
Interpolate between the percentile mark and the next value. The median for the sample table is 2.83 which is an interpolation between 2 and 3.
Six people gave a response of 2 and Quantum assumes that they are evenly spaced between the two interpolation values of 2 and 3; that is, that they are spaced at intervals of 1/6 = 0.16667. The median respondent is the fifth respondent who answered 2. The median is therefore calculated as:
5 x 0.16667 + 2 = 2.83
Note medint does not affect percentiles calculated from factors using an n30 statement. For these percentiles, Quantum uses an interpolation method similar to medint=0.
See
Special interpolation method
See also
Creating percentiles and medians