Quartiles: Measure of relative standing of an observation within data
Like Percentile and Deciles, Quartiles is a type of Quantile, which is a measure of the relative standing of observation within the data set. Quartiles are the values are three points that divide the data into four equal parts each group comprising a quarter of the data (the first quartile $Q_1$, second quartile $Q_2$ (also median) and the third quartile $Q_3$) in the order statistics. The first quartile, (also known as the lower quartile) is the value of order statistic that exceeds 1/4 of the observations and less than the remaining 3/4 observations. The third quartile is known as upper quartile is the value in the order statistic that exceeds 3/4 of the observations and is less than remaining 1/4 observations, while the second quartile is the median.
Quartiles for Ungrouped Data
For ungrouped data, the quartiles are calculated by splitting the order statistic at the median and then calculating the median of the two halves. If n is odd, the median can be included in both sides.
Example: Find the $Q_1, Q_2$ and $Q_3$ for the following ungrouped data set 88.03, 94.50, 94.90, 95.05, 84.60.Solution: We split the order statistic at the median and calculate the median of two halves. Since n is odd, we can include the median in both halves. The order statistic is 84.60, 88.03, 94.50, 94.90, 95.05.
\begin{align*}
Q_2&=median=Y_{(\frac{n+1}{2})}=Y_{(3)}\\
&=94.50 (\text{the third observation})\\
Q_1&=\text{Median of the first three value}=Y_{(\frac{3+1}{2})}\\&=Y_{(2)}=88.03 (\text{the second observation})\\
Q_3&=\text{Median of the last three values}=Y_{(\frac{3+5}{2})}\\
&=Y_{(4)}=94.90 (\text{the forth observation})
\end{align*}
Quartiles for Grouped Data
For the grouped data (in ascending order) the quartiles are calculated as:
\begin{align*}
Q_1&=l+\frac{h}{f}(\frac{n}{4}-c)\\
Q_2&=l+\frac{h}{f}(\frac{2n}{4}-c)\\
Q_3&=l+\frac{h}{f}(\frac{3n}{4}-c)
\end{align*}
where
l is the lower class boundary of the class containing the $Q_1,Q_2$ or $Q_3$.
h is the width of the class containing the $Q_1,Q_2$ or $Q_3$.
f is the frequency of the class containing the $Q_1,Q_2$ or $Q_3$.
c is the cumulative frequency of the class immediately preceding to the class containing $Q_1,Q_2$ or $Q_3, \left[\frac{n}{4},\frac{2n}{4} \text{or} \frac{3n}{4}\right]$ are used to locate $Q_1,Q_2$ or $Q_3$ group.
Example: Find the quartiles for the following grouped data
\begin{align*}
Q_1&=l+\frac{h}{f}(\frac{n}{4}-c)\\
&=90.5+\frac{5}{4}(7.5-6)=90.3750
\end{align*}
For $Q_2$, the $\frac{2n}{4}$th observation=$\frac{2 \times 30}{4}$th observation = 15th observation falls in the group 95.5–100.5.
\begin{align*}
Q_2&=l+\frac{h}{f}(\frac{2n}{4}-c)\\
&=95.5+\frac{5}{10}(15-10)=98
\end{align*}
For $Q_3$, the $\frac{3n}{4}$th observation=$\frac{3\times 30}{4}$th = 22.5th observation. So
\begin{align*}
Q_3&=l+\frac{h}{f}(\frac{3n}{4}-c)\\
&=100.5+\frac{5}{6}(22.5-20)=102.5833
\end{align*}
Reference: