# How do I find percentiles of data sets (Even vs odd)?

Given the following data set with an even number of values:
$100, 100, 105, 113, 129, 132, 146, 152, 176, 200$

The value representing the 30th percentile, using the formula n(p/100) where n = sample size and p = percentile, is at position 10(0.30) = 3. So the 30th percentile of this data is 105.

Given the following data set with an odd number of values:
$100, 100, 105, 113, 129, 132, 146, 152, 176, 200, 300$

The value representing the 30th percentile, using the formula n(p/100) where n = sample size and p = percentile, is at position 11(0.30) = 3.3. So now what does one do?

I realize that this formula can yield a decimal even if the data set has an even amount of values, say if n = 36, and you want the 10th percentile, 36(.10) = 3.6.

In this situation, do you average the 3rd and 4th values? Or is it the 3rd value? or the 4th value? How do you decide? What if the position was 3.2 or 3.7? Does it matter in choosing which value is represents the given percentile?

Thanks for any help ahead of time.

• According to wikipedia article on percentiles, you use the ceiling. But this conflicts with the article on median which it says is the same as the 50th percentile and calculates it as an interpolation. So it is either an interpolation: 105+0.3(113-105), or it is the "next biggest": 113. – David Peterson Dec 17 '14 at 5:52
• Wikipedia's Quantile article gives nine different calculation methods. Personally I like R-2 for a population and R-7 for a sample – Henry Feb 19 '17 at 20:31
• I would expect that this very much depends on what you need to do with percentiles; although I can't think of an example, I expect if it isn't entirely clear how to resolve this based on what you're doing with the percentiles, then it probably doesn't make a whole lot of difference. – Vedvart1 Jun 8 '17 at 5:40
• From a script on probability and statistics (by L. Meier, ETHZ): For an empirical quantile $q_\alpha (0<\alpha<1)$ for an ordered data set: $q_\alpha = \frac{1}{2}(x_{n\alpha}+x_{n\alpha+1})$ if $\alpha\cdot n$ is even, else $q_{\alpha} = x_{\ceil{\alpha\cdot n} }$. Here $n$ is the number of entries in the data set. – Nox Dec 21 '17 at 14:49
• – Ethan Bolker Jun 29 at 11:07

1. Order all the numbers in the data set from smallest to largest.

2. Multiply percent times the total number of numbers, n.

3a. If your result from Step 2 is a whole number, go to Step 4. If the result from Step 2 is not a whole number, round it up to the nearest whole number and go to Step 3b.

3b. Count the numbers in your data set from left to right (from the smallest to the largest number) until you reach the value from Step 3a. This corresponding number in your data set is the kth percentile.

1. Count the numbers in your data set from left to right until you reach that whole number. The kth percentile is the average of that corresponding number in your data set and the next number in your data set.

Given the following data set with an even number of values: 100,100,105,113,129,132,146,152,176,200-you correctly caculated 3 which is a whole number. Step 4 says to count from left to right until you reach the third number which is 105. Additionally step 4 says to average 105 and the next number in the set which is 113. You get 109. Therefore the 30th percentile of this data is 109.

Now for the set 100,100,105,113,129,132,146,152,176,200,300 you correctly figured 3.3 so according to step 3a round 3.3 up to 4 and go to step 3b. Step 3b says to count from left to right until you get to the 4th number which is 113. 113 is the 30th percentile in this case.