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?
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?
On
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:
$\{1,3,4,4,5,7,8\}$
The median is 4 (the second one), so the lower subset is $\{1,3,4\}$ and the upper subset is $\{5,7,8\}$.
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:
$\{2,4,6,8,10,12\}$
The median is 7, so the lower subset is $\{2,4,6\}$ and the upper subset is $\{8,10,12\}$. So the first and third quartiles are 4 and 10, respectively.
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\%$ or $75\%$ 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.