Mean, median and mode for grouped data

Let $(x_i,f_i), i=1,2, \cdots , n$ be given frequency distribution.

Sample mean

The mean of $X$ is denoted by $\overline{x}$ and is given by

$\overline{x} =\dfrac{1}{N}\sum_{i=1}^{n}f_ix_i$

In case of continuous frequency distribution, $x_i$'s are the mid-values of the respective classes.

Sample median

The median is given by

$\text{Median } = l + \bigg(\dfrac{\frac{N}{2} - F_<}{f}\bigg)\times h$

where,

• $N$, total number of observations
• $l$, the lower limit of the median class
• $f$, frequency of the median class
• $F_<$, cumulative frequency of the pre median class
• $h$, the class width

Sample mode

The mode of the distribution is given by

$\text{Mode } = l + \bigg(\dfrac{f_m - f_1}{2f_m-f_1-f_2}\bigg)\times h$

where,

• $l$, the lower limit of the modal class
• $f_m$, frequency of the modal class
• $f_1$, frequency of the class pre-modal class
• $f_2$, frequency of the class post-modal class
• $h$, the class width

Example 1

Following is the data about the daily number of car accidents during a month

No. of car accidents 1 2 3 4 5 6 7
No. of days 2 4 4 10 7 2 1

Caclulate mean, median and mode.

Solution

x f f*x cf
1 2 2 2
2 4 8 6
3 4 12 10
4 10 40 20
5 7 35 27
6 2 12 29
7 1 7 30
Total 30 116

Mean

The mean number of accidents is

\begin{aligned} \overline{x} &=\frac{1}{N}\sum_{i=1}^n f_ix_i\\ &=\frac{116}{30}\\ &=3.8667 \end{aligned}

Median

Median number of accidents is \begin{aligned} \text{Median} &=\bigg(\dfrac{N}{2}\bigg)^{th}\text{ value}\\ &= \bigg(\dfrac{30}{2}\bigg)^{th}\text{ value}\\ &=\big(15\big)^{th}\text{ value} \end{aligned} The cumulative frequency just greater than or equal to $15$ is $20$. The corresponding value of $x$ is median. That is, $M =4$.

Thus, median number of accidents $M$ = $4$.

Mode

Mode is the value of $x$ with maximum frequency.

The maximum frequency is $10$. The value of $x$ corresponding to the maximum frequency $10$ is $\text{Mode }=4$.

Example 2

The following table gives the amount of time (in minutes) spent on the internet each evening by a group of 56 students. Compute five number summary for the following frequency distribution.

Time spent on Internet ($x$) 10-12 13-15 16-18 19-21 22-24
No. of students ($f$) 3 12 15 24 2

Solution

The classes are inclusive. To make them exclusive type subtract 0.5 from the lower limit and add 0.5 to the upper limit of each class.

Class Interval Class Boundries mid-value (x) Freq (f) f*x cf
10-12 9.5-12.5 11 3 33 3
13-15 12.5-15.5 14 12 168 15
16-18 15.5-18.5 17 15 255 30
19-21 18.5-21.5 20 24 480 54
22-24 21.5-24.5 23 2 46 56
Total 56 982

Mean

The mean time spent on internet is

\begin{aligned} \overline{x} &=\frac{1}{N}\sum_{i=1}^n f_ix_i\\ &=\frac{982}{56}\\ &=17.5357 \text{ minutes} \end{aligned}

Median

Median time spent on internet by the students is \begin{aligned} \text{Median} &=\bigg(\dfrac{N}{2}\bigg)^{th}\text{ value}\\ &= \bigg(\dfrac{56}{2}\bigg)^{th}\text{ value}\\ &=\big(28\big)^{th}\text{ value} \end{aligned} The cumulative frequency just greater than or equal to $28$ is $30$. The corresponding class $15.5-18.5$ is the median class.

Thus

• $N=56$, total number of observations
• $l = 15.5$, the lower limit of the median class
• $f =15$, frequency of the median class
• $F_< = 15$, cumulative frequency of the pre median class
• $h =3$, the class width

The median can be computed as follows:

\begin{aligned} \text{Median } &= l + \bigg(\frac{\frac{N}{2} - F_<}{f}\bigg)\times h\\ &= 15.5 + \bigg(\frac{\frac{56}{2} - 15}{15}\bigg)\times 3\\ &= 15.5 + \bigg(\frac{28 - 15}{15}\bigg)\times 3\\ &= 15.5 + \big(0.8667\big)\times 3\\ &= 15.5 + 2.6\\ &= 18.1 \text{ minutes} \end{aligned}

Mode

The maximum frequency is $24$, the corresponding class $18.5-21.5$ is the modal class.

Mode of the given frequency distribution is: \begin{aligned} \text{Mode } &= l + \bigg(\frac{f_m - f_1}{2f_m-f_1-f_2}\bigg)\times h\\ \end{aligned} where,

• $l = 18.5$, the lower limit of the modal class
• $f_m =24$, frequency of the modal class
• $f_1 = 15$, frequency of the pre-modal class
• $f_2 = 2$, frequency of the post-modal class
• $h =3$, the class width

Thus mode of a frequency distribution is

\begin{aligned} \text{Mode } &= l + \bigg(\frac{f_m - f_1}{2f_m-f_1-f_2}\bigg)\times h\\ &= 18.5 + \bigg(\frac{24 - 15}{2\times24 - 15 - 2}\bigg)\times 3\\ &= 18.5 + \bigg(\frac{9}{31}\bigg)\times 3\\ &= 18.5 + \big(0.2903\big)\times 3\\ &= 18.5 + \big(0.871\big)\\ &= 19.371 \text{ minutes} \end{aligned}