# Thread: Standart deviation for two groups

1. ## Standart deviation for two groups

Hello guys,
Here is my problem. I have two groups the first one is from 42 members and the second -36. I have the average of the two groups and their standard deviation value, but i don't have their individual results. How can I calculate the average and standard deviation for the whole 78 members.

2. Originally Posted by Pumata
Hello guys,
Here is my problem. I have two groups the first one is from 42 members and the second -36. I have the average of the two groups and their standard deviation value, but i don't have their individual results. How can I calculate the average and standard deviation for the whole 78 members.
Let group 1 have a mean $\bar{x}$, variance $s_x^2$ and be of size n. Then:

$\bar{x} = \frac{\sum_{i=1}^{n} x_i}{n} \Rightarrow \sum_{i=1}^{n} x_i = n \bar{x}$ .... (1)

$s_x^2 = \frac{\sum_{i=1}^{n} x_i^2}{n} - \bar{x}^2 \Rightarrow n\left(s_x^2 + \bar{x}^2 \right) = \sum_{i=1}^{n} x_i^2$ .... (2)

Let group 2 have a mean $\bar{y}$, variance $s_y^2$ and be of size m. Then:

$\bar{y} = \frac{\sum_{i=1}^{m} y_i}{m} \Rightarrow \sum_{i=1}^{m} y_i = m \bar{y}$ .... (3)

$s_y^2 = \frac{\sum_{i=1}^{m} y_i^2}{m} - \bar{y}^2 \Rightarrow m \left(s_y^2 + \bar{y}^2 \right) = \sum_{i=1}^{m} y_i^2$ .... (4)

Let the whole group (group 1 plus group 2) have a mean $\bar{z}$ and variance $s_z^2$. The whole group has size n + m. Then:

$\bar{z} = \frac{\sum_{i=1}^{n+m} z_i}{n + m} = \frac{\sum_{i=1}^{n} x_i + \sum_{i=1}^{m} y_i }{n + m}$.

Substitute from (1) and (3): $\bar{z} = \frac{n \bar{x} + m \bar{y}}{n+m}$.

$s_z^2 = \frac{\sum_{i=1}^{n+m} z_i^2}{n+m} - \bar{z}^2 = \frac{\sum_{i=1}^{n} x_i^2 + \sum_{i=1}^{m} y_i^2}{n+m} - \bar{z}^2$.

Substitute from (2) and (4): $s_z^2 = \frac{n \left( s_x^2 + \bar{x}^2 \right) + m \left( s_y^2 + \bar{y}^2 \right)}{n+m} - \bar{z}^2$

3. Thank you mr fantastic!
The last formula was what I was searching for