# How to calculate the standard deviation of numbers with standard deviations?

I have essentially a propagation-of-error problem I run into frequently with my scientific data. For example, I have three samples, each of which I take two measurements of. So, for each sample, I can calculate a mean and a standard deviation. However, I can then calculate the mean of the three samples together, and a standard deviation for this mean. However, this feels like it underestimates the deviation, as we have not factored in the uncertainty in the mean of each. To be specific with an example:

I have three samples (which are supposedly identical), called A, B, and C. Each sample is measured twice: for instance, A is 1.10 and 1.15, B is 1.02 and 1.05, and C is 1.11 and 1.09. Using Excel, I quickly calculate means and standard deviations for each (A: mean 1.125, stdev 0.0353...; B: mean 1.035, stdev 0.0212; C: mean 1.10, stdev 0.0141). But then I want to know the mean and standard deviation of the total. The mean is easy: 1.09; I can also calculate the standard deviation for that calculation: 0.05. But this seems to not take into account the error found in the numbers I am averaging.

Any ideas?

• Your "three" samples are six samples. – Martín-Blas Pérez Pinilla Oct 2 '14 at 9:08
• Such questions are better asked at our statistics sister site, Cross Validated. But it is on-topic here too! – kjetil b halvorsen Oct 2 '14 at 9:08
• Martin-Blas, you are correct that this could be viewed this way. However, we find in biology that we have "biological replicates" and "technical replicates," which are an important distinction. "Biological replicates" means I took three supposedly identical batches of cells and did the same experiment on them. These should all give me the same result, but in practice the variation in biological systems means there may be a fair bit of variation between them. "Technical replicates" means I took multiple measurements of each biological replicate, and these should have less variance. – Simeon Oct 2 '14 at 9:21

Standard deviation is only a measurement of dispersion of your data in your 3 samples. All three samples will have the same standard deviation if they are supposed identical.

In order to take precision of measurement into consideration, you have to calculate the standard error, which is basically the standard deviation divided by $\sqrt(n)$ where n is the number of measurements youjust used to calculate the mean. Adding more measurements will then involve a decrease in the standard error. This standard error (SE) can then be used to calculate a confidence interval, usually using a normal approximation saying that the "true" mean in the overall sample has a probability of 95% being in the interval [mean - 1.96*SE ; mean + 1.96*SE]

EDIT: here is a great course about the distinction between standard error and standard deviation, by Douglas Altman in the BMJ Statistics Notes: http://www.bmj.com/content/331/7521/903.full.pdf+html

I have essentially a propagation-of-error problem

First, a note about terminology: the correct term is uncertainty, not error (error is a different thing). And your problem is not really a problem about propagation of uncertainty.

Evaluation of uncertainty is in general a difficult task, even in your case might not be that simple. To provide advice on this, the BIPM (Bureau International des Poids et Mesures) issued a number of guides which can be found here. So, I firstly suggest you to have a look a this guides.

Then, there are a few issues involved in your analysis (and in what is said by Joe the frenchy): I'll discuss these in a couple of days, modifying this post.

You have $$x_{11}=1.10, x_{12}=1.15 \\ x_{21}=1.02, x_{22}= 1.05 \\ x_{31}=1.11, x_{32}=1.09$$ Your question is unclear, because you did not state an statistical model, so we do not really know what are reasonable assumptions for your data. If you think all your data have a common mean, then you can just treat them as one sample with $n=n_1+n_2+n_3=2+2+2=6$ observations. That gives (using R, much better than excel, and free...):

> x1
[1] 1.10 1.15
> x2
[1] 1.02 1.05
> x3
[1] 1.11 1.09
> x
[1] 1.10 1.15 1.02 1.05 1.11 1.09
> c (mean(x), sd(x))
[1] 1.08666667 0.04589844


On the other hand, it seems like your assumption is that the means can be different, but the standard deviations (the theoretical parameter $\sigma$) are the same. Then you can use the pooled standard deviation, which is the square root of the pooled sample variance: In this case, the number of observations in each group are equal, so all gets the same weight:

> sqrt(mean(c(var(x1),var(x2),var(x3))))
[1] 0.02516611


Compare this to the three individual standard deviations:

> c(sd(x1),sd(x2),sd(x3))
[1] 0.03535534 0.02121320 0.01414214


There is no systematic difference. But, there is still another possibility. You might have three groups in the data, but your model is that the (theoretical) means and variances are the same. The simplest thing is to do as first above, the group the 6 observations in one group. But the calculations might be already done and reported, and you do not have access to the individual data points. Then the correct method is to add a term depending on the differences between the means. The algebra is as follows: $$s^2 = \frac{1}{6-1} \sum_{i=1}^3\sum_{j=1}^2 (x_{ij}-\bar{x})^2 \\ = \frac{1}{6-1} \sum_{i=1}^3\sum_{j=1}^2 ((x_{ij}-\bar{x_i}) +(\bar{x_i}-\bar{x}))^2 \\ = \frac{1}{6-1} \sum_{i=1}^3\sum_{j=1}^2\left( (x_{ij}-\bar{x_i})^2 + (\bar{x_i}-\bar{x})^2 + \underbrace{2(x_{ij}-\bar{x_i})(\bar{x_i}-\bar{x})}_{\text{j-sum over this term is zero}}\right) \\ = \frac{1}{6-1} \left(\sum_{i=1}^3 s_i^2 + 2\sum_{i=1}^3 (\bar{x_i} -\bar{x}^2 \right)$$ (with standard definitions of all the terms). So you see, you get a correction term using differences between the group means and the overall mean.