Find the value of the $5$th decile, $D_5$. For the data set:
$$18,15,12,6,8,2,3,5,20,10$$
Find the value of the $5$th decile, $D_5$.
I computed this 2 ways and each time I got a different answer.

*

*If the sample size is $n$, then the rank of the $m$th decile is $\frac{mn}{10}$. So in our case it would be $\frac{5(10)}{10}=5$. So it would be the fifth value in the data after we arrange them from the smallest to the largest.

$$2,3,5,6,8,10,12,15,18,20$$
So it would be $D_5=8$.


*We know that $D_5=Q_2$, where $Q_2$ is the second quartile. $Q_2$ is the value with $50%$ of the data below it, so it is the mean of the data. In this case the mean is $9$
So is it $8$ or $9$? Any help would be appreciated. Thanks!
 A: If you use the nearest rank method you came with this inconsisty, just as pointed in quintile from wikipedia

There are $q − 1$ partitions of the q-quantiles, one for each integer $k$ satisfying $0 < k < q$. In some cases the value of a quantile may not be uniquely determined, as can be the case for the median ($2$-quantile) of a uniform probability distribution on a set of even size.

If you use linear interpolation, you determine the position $p$ of the $q$-quantile in the partition $k$ in your set $X$ as
$$p:={k\over q}(N+1) $$
and the value in the position $p$ computing
$$f(p) = \begin{cases}
X_{\lfloor p\rfloor}+\left(X_{\lceil p\rceil}-X_{\lfloor p\rfloor}\right)\cdot (p-\lfloor p\rfloor) & ,p\notin\Bbb N \\[2ex]
X_p & ,p\in\Bbb N 
\end{cases}$$
where $X_p$ is the $p$-element of your ordered set and $\lfloor p\rfloor$ is the integer part of your real number and $\lceil p\rceil = \lfloor p\rfloor +1$.
Appying to your case goes like this. The position $p$ of $D_5$ is calcuted as
$$p={5\over 10}(11)=5.5 $$
then $f(5.5)$ is equal to
$$f(5.5)=8+(10-8)\cdot(0.5)=8+2\cdot0.5=9 $$
If you do the same for the median, gives the same result making consistent.
