# Calculating the 1st quartile: different result with Excel, Wolfram Alpha and using formula in my math book - why?

I have the following set of numbers: 1, 1, 8, 12, 13, 13, 14, 16, 19, 22, 27, 28, 31

I'm supposed to calculate the value of the 1st quartile (25th percentile) in this data set.

Somebody has noted in a Stack Overflow post (https://stackoverflow.com/a/53551756) this behavior with Python programming language too.

Can someone please explain why the results differ in these different methods? What makes this very specific data set special so that these methods give different values? Which of these values is the correct / most correct one and why?

• R gives nine ways of calculating quantiles. In this case, its methods give $12,12,8,9,11,10,12,10.667,10.75$. For a population, I like the second value, while for a sample I like the seventh, both of which are $12$ here, but there are arguments for others – Henry Jul 31 at 13:28

The issue here is that (unlike the median) there is no universally recognised definition of the quartiles for a sample. Wikipedia gives three possible methods of calculating the lower quartile.

For an even number of points, these will all give the same answer, which is the median of the smaller half of the sample. But if you have an odd number of points, they will often give three different answers.

This is because for an even number of points, the $$1/4$$ point of your data either hits one of the points exactly or falls exactly in between two points (in the same way that the halfway point does for any number of points). For an odd number of points, it falls nearer to one point than any other, but not exactly on any point. For $$13$$, as you have, you really want the $$3.75$$th data point. The three methods (in wikipedia order) come down to

1. rounding this down to $$3.5$$th, so averaging the $$3$$rd and $$4$$th (your book)
2. rounding this up to $$4$$th (Excel)
3. computing the value $$0.75$$ of the way between $$3$$rd and $$4$$th (Wolfram)

I don't think any of these is "more correct" than any other; if one were, probably everyone would agree. If you're learning this for an exam, your exam board will presumably have a policy on which of these they give credit for.

• Ok, I didn't realize there are three different ways of calculating quartiles that yield different results in certain scenarios. Pretty much any other time in math it seems for me that there is only one, single truth (although there may be multiple methods with which to arrive to that truth). In this case I was so confused why the values were different. I will use the method in my book in my upcoming exams. Thank you! – highSchoolIsFun2019 Jul 31 at 14:04