Mean, median and mode for ungrouped data

Let $x_i, i=1,2, \cdots , n$ be $n$ observations.

Formula

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

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

Arrange the data in ascending order of magnitude.

Median of $X$ is given by

Median

$$ \begin{equation*} M= \left\{ \begin{array}{ll} \text{value of }\big(\frac{n+1}{2}\big)^{th}\text{ observation}, & \hbox{if $n$ is odd;} \\ \text{average of }\big(\frac{n}{2}\big)^{th}\text{ and }\big(\frac{n}{2}+1\big)^{th} \text{ observation}, & \hbox{if $n$ is even.} \end{array} \right. \end{equation*} $$

Mode is the value of $X$ that occurs maximum number of times.

Example 1

A random sample of 15 patients yielded the following data on the length of stay (in days) in the hospital.

5, 6, 9, 10, 15, 10, 14, 12, 10, 13, 13, 9, 8, 10, 12.

Find the mean, median and mode.

Solution

Mean

The sum of observations is $\sum x_i =156$ days.

The mean of the length of stay in the hospital is

$$ \begin{aligned} \overline{x} &=\frac{1}{n}\sum_{i=1}^n x_i\\ &=\frac{156}{15}\\ &=10.4 \text{ days}. \end{aligned} $$

Median

The data in ascending order of magnitude is $5, 6, 8, 9, 9, 10, 10, 10, 10, 12, 12, 13, 13, 14, 15$.

Here $n = 15$ which is odd.

Sample median = value of $(\frac{n+1}{2})^{th}$ observations.

Thus the median of the length of stay in the hospital is

$$ \begin{aligned} M &= \bigg(\frac{15+1}{2}\bigg)^{th}\text{Obs.} \\ &= \big(8\big)^{th}\text{Obs.} \\ &=10 \text{ days}. \end{aligned} $$

Mode

The observation $10$ occurs with a highest frequency of 4.

The mode of the length of stay in the hospital is $10$ days.

Example 2

The age (in years) of 6 randomly selected students from a class are

22, 25, 24, 23, 24, 20.

Find the mean, median and mode.

Solution

Mean

The sum of observations is $\sum x_i =138$ days.

The mean age of students is

$$ \begin{aligned} \overline{x} &=\frac{1}{n}\sum_{i=1}^n x_i\\ &=\frac{138}{6}\\ &=23 \text{ years}. \end{aligned} $$

Median

The data in ascending order of magnitude is $20, 22, 23, 24, 24, 25$.

Here $n = 6$ which is even.

Sample median = average of $(\frac{n}{2})^{th}$ and $(\frac{n}{2}+1)^{th}$ observations.

Thus the median age of students is

$$ \begin{aligned} M &= \frac{\big(\frac{6}{2}\big)^{th}\text{Obs.} +\big(\frac{6}{2}+1\big)^{th}\text{Obs.}}{2}\\ &= \frac{\big(3\big)^{th}\text{Obs.} +\big(4\big)^{th}\text{Obs.}}{2}\\ &=\frac{23 +24}{2} \\ &= 23.5 \text{ years}. \end{aligned} $$

Mode

The observation $24$ occurs with a highest frequency of 2.

The mode of age of students is $24$ years.

Related Resources