 rmd1228887e

2022-07-09

Calculating Quartiles Dilemma
When I am calculating the lower quartile and upper quartile, why am I taking (n+1)/4 and 3(n+1)/4, instead of n/4 and 3n/4?
According to me, if total number of observations are n, then that should be counted figuring out the quartiles, isn't it? Expert

You need to look at the definition of quartile you are using. For large $n$ it will not matter much, but it appears the definition you are using is the datum that exceeds $25\mathrm{%}$ or $75\mathrm{%}$ of the data. The $+1$ is there for the "exceed". Wikipedia gives three different definitions of quartile, with a data set that shows the differences. rzfansubs87

Expert

Without a formula, you can always finding the first and third quartiles using two easy steps.
First, find the median of the entire set. Then divide the set into two subsets: elements that are lesser than the median, and elements that are greater than the median. (Note: if the median is repeated in the set, include the duplicates in these subsets.)
Now find the medians of these two subsets. Those are the first and third quartile values.
Example 1, odd number of elements:
$\left\{1,3,4,4,5,7,8\right\}$
The median is 4 (the second one), so the lower subset is $\left\{1,3,4\right\}$ and the upper subset is $\left\{5,7,8\right\}$
The medians of those 2 subsets are 3 and 7. So the first quartile value is 3 and the third quartile value is 7.
Example 2, even number of elements:
$\left\{2,4,6,8,10,12\right\}$
The median is 7, so the lower subset is $\left\{2,4,6\right\}$ and the upper subset is $\left\{8,10,12\right\}$. So the first and third quartiles are 4 and 10, respectively.

Do you have a similar question?