## Variance and standard deviation for ungrouped data

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

## Formula

Sample variance of $X$ is denoted by $s_{x}^2$ and is given by

$s_x^2 =\dfrac{1}{n-1}\sum_{i=1}^{n}(x_i -\overline{x})^2=\dfrac{1}{n-1}\bigg(\sum_{i=1}^{n}x_i^2-\dfrac{\big(\sum_{i=1}^n x_i\big)^2}{n}\bigg)$

where,

• $\overline{x}=\dfrac{1}{n}\sum_{i=1}^{n}x_i$ is the sample mean

The sample standard deviation of $X$ is defined as the positive square root of the sample variance. The sample standard deviation of $X$ is given by

$s_x =\sqrt{s_x^2}$

## Example 1

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

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

Find the variance and standard deviation.

### Solution

$x_i$ $x_i^2$
22 484
25 625
24 576
23 529
24 576
20 400
Total 138 3190

Sample mean

The sample mean of $X$ is

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

The average of age of students is $23$ years.

Sample variance

Sample variance of $X$ is

\begin{aligned} s_x^2 &=\dfrac{1}{n-1}\bigg(\sum_{i=1}^{n}x_i^2-\frac{\big(\sum_{i=1}^n x_i\big)^2}{n}\bigg)\\ &=\dfrac{1}{5}\bigg(3190-\frac{(138)^2}{6}\bigg)\\ &=\dfrac{1}{5}\big(3190-\frac{19044}{6}\big)\\ &=\dfrac{1}{5}\big(3190-3174\big)\\ &= \frac{16}{5}\\ &=3.2 \end{aligned}

Sample standard deviation

The standard deviation is the positive square root of the variance.

The sample standard deviation is

\begin{aligned} s_x &=\sqrt{s_x^2}\\ &=\sqrt{3.2}\\ &=1.7889 \text{ years} \end{aligned}

Thus the standard deviation of age of students is $1.7889$ years.

## Example 2

The following data gives the hourly wage rates (in dollars) of 10 employees of a company.

20,21,24,25,18,22,24,22,20,22.

Find the variance and standard deviation of hourly wage rates.

### Solution

$x_i$ $x_i^2$
20 400
21 441
24 576
25 625
18 324
22 484
24 576
22 484
20 400
22 484
Total 218 4794

Sample mean

The sample mean of $X$ is

\begin{aligned} \overline{x} &=\frac{1}{n}\sum_{i=1}^n x_i\\ &=\frac{218}{10}\\ &=21.8\text{ dollars} \end{aligned}

The average of hourly wage rates is $21.8$ dollars.

Sample variance

Sample variance of $X$ is

\begin{aligned} s_x^2 &=\dfrac{1}{n-1}\bigg(\sum_{i=1}^{n}x_i^2-\frac{\big(\sum_{i=1}^n x_i\big)^2}{n}\bigg)\\ &=\dfrac{1}{9}\bigg(4794-\frac{(218)^2}{10}\bigg)\\ &=\dfrac{1}{9}\big(4794-\frac{47524}{10}\big)\\ &=\dfrac{1}{9}\big(4794-4752.4\big)\\ &= \frac{41.6}{9}\\ &=4.6222 \end{aligned}

Sample standard deviation

The standard deviation is the positive square root of the variance.

The sample standard deviation is

\begin{aligned} s_x &=\sqrt{s_x^2}\\ &=\sqrt{4.6222}\\ &=2.1499 \text{ dollars} \end{aligned}

Thus the standard deviation of hourly wage rates is $2.1499$ dollars.