# Calculating the 50th percentile in a small data set

I'm trying to learn the concept of percentile.

Question: Given these numbers: {1, 2, 3, 900}, I'm trying to calculate the 50th percentile.

My answer: 3. But different websites are saying: 2.5

My reasoning: Two values (1 and 2) are below the value number 3. There are overall 4 values in the data set, so 50% (2 our of 4) of the values are smaller than 3. I'm using wikipedia's definition:

A percentile is a measure indicating the value below which a given percentage of observations in a group of observations falls

What am I missing?

The Wikipedia wording isn't wildly wrong but it doesn't give a precise rule, which is what you need.

Consider this variant on your argument. Two numbers of 1, 2, 3, 900 are above 2. There are 4 values in total, so 50% are larger than 2. So choose 2 as the answer.

What is reported as the middlemost (a word Galton used) value should not depend on whether you start at the lowest value and work up or start at the highest value and work down. There is a clear answer either way if the number of values is odd but we need a rule for the number of values being even, as is 4.

With an even number of values, using the midpoint between the two middle values (the "comedians", naturally) as the median or 50th percentile is explained as a convention to mathematical audiences and as a rule to everybody else.

NB: Which calculation rule to use for arbitrary percentiles is (surprisingly perhaps) wide open territory with on one count nine different ways to do it. That is well covered in other threads. Here I focus on the small fallacy exposed in the question.

For even sample sizes the median is the average of two observations in the middle, in your case it's 2.5. That's what Excel does, by the way. Here's a quote from MS Office doc:

If there is an even number of numbers in the set, then MEDIAN calculates the average of the two numbers in the middle.

See OPTIMAL QUANTILE ESTIMATORS SMALL SAMPLE APPROACH by Zielinski. I strongly suggest you read through this work - the point here is that you are likely estimating a quantile from an assumed continuous distribution which you only have a finite sample from.

See the optimal estimators section. These have various properties that can be desirable (e.g. unbiased with minimum variance, minimum absolute deviation, most-concentrated, etc.). Note that these estimators are often probabilistic (e.g. 50% - the value is 2, 50% - the value is 3).

So the answer will depend on what properties of the estimator would be valuable in your particular situation

• I think this is pitched on a quite different level of abstraction from the question. It's not really about estimator properties. It is just about the precise rule for a calculation, and why or whether anyone should want the median or anything else are quite different ball games. May 21, 2020 at 9:22

So as Sergio mentioned, the 50th percentile is the median (as per the Wikipedia page on percentiles - look at the 2nd last sentence in the intro blurb). Thus, we may proceed assuming we are trying to calculate the median for the set given.

Your reasoning is somewhat correct. To calculate median, the median must have an equal count of numbers within the set both above and below the median. I suspect you extended this concept to "50% above and below median". However, if we apply the same test to your data set of {1, 2, 3, 900}, if 3 is the median, we find that 50% of the set is below ({1,2}) and 25% is above ({900}). Given that $$25\% \neq 50\%$$, we know that 3 cannot be the median.

Let us, for now, look at a set with an odd count of numbers (rather than an even count as you have). Let us take {1,2,3,4,900}. Now, the median is indeed 3, as we have 50% of the numbers below ({1,2}) and 50% above ({4,900}).

We may now proceed to the sets with an even count of numbers. Let us take {1,2,3,4}. Here, no matter what number we pick from the set, we cannot have an equal count of numbers above and below (convince yourself of this). Thus, we, as a mathematical community, have accepted that the median is the mean of the combination of the 2 numbers that are closest to what would be the median. In this case, those 2 numbers are $$2$$ and $$3$$, as both are as close to the center of the ordered set as possible. Thus, we take the mean of these 2 values to get $$2.5$$ as the median.

By extending this logic, we can see that the median of the set {1,2,3,900} would be the mean of $$2$$ and $$3$$ and would be $$2.5$$.

The median would be the average of 2 and 3, as the set has an even cardinality. Thus, your answer is 2.5