# Help!! Need advice on calculating percentiles

#### jhall251

##### New Member
Hi -

Hoping I can get some opinions on the method we are using to calculate percentiles.

I work with a small non-profit - I need to calculate percentiles for a number of fee ranges, i.e. what is the median fee charged, 45th ptile, 55th ptile etc. in different regions of our state.

We have been calculating percentiles as follows:

- rank order all the fees from low to high
- locate the integer of the p*nth record (e.g. if the desired ptile is the 45th then go to the record number that is the integer portion of .45*total records)
- If the record number is even take that record value as the pth ptile.
- if the record number is odd go to the next higher number, take the average of the two values and call that the pth ptile.

I recently compared the results of the above to the results of calculating the ptiles in excel using the excel percentile function. Mostly there was no difference in results but in the smaller data sets there were differences. I know that there are several methods for calculating ptiles. Is the above method okay? How might it be improved?

Thanks for any help!!!

Last edited:

#### BioStatMatt

##### TS Contributor
The method you are using is fine. It is consistent. That is, as the sample size becomes large, your estimator for the percentile becomes better.

Another method:

Say we have a sample of size 100. We want the 25th percentile. Order the data and take a weighted average between observations whose indicies flank (100+1)*(0.25) = 25.25. If Y25 and Y26 are the 25th and 26th order statistics, then take the 25th percentile to be 0.75*Y25 + 0.25Y26. This method is also consistent

~Matt

#### jhall251

##### New Member
Thanks very much for the feedback. If you have time to respond, I have some further questions - if you don't have time, don't worry about it. What is the advantage of the weighted avg as you describe over a simple average? And why is the lower limit weighted more than the upper one? Would the same weights apply at all percentile values? Thanks again....