# Standard Deviation After Subtracting One Mean From Another

I've got two sets of data from some fluorescent cells.

The first set is when the cells don't have their fluorescence switched on, but they are still faintly glowing.

The second set is when they do have their fluorescence switched on.

I ran each of the two experiments three times, so n=3, and I therefore have a mean for each dataset and a SD.

I need to subtract the non-switched on set from the switched on set in order to determine the amount of fluorescence that arises as a result of being switched on.

How do I then calculate the SD of the final value?

I know that for discrete random variables,

$$E[X+Y] = E[X] + E[Y]$$

So I assume that holds true for subtraction as well, but I can't find the rules for continuous random variables, as these are.

Example data for one data point:

         ON            OFF
MEAN:  33956.6666    3835.66667
SD:    457.47301     38.0905

• If you have the original data, you can simple compute the difference between ON and OFF in each sell, and then compute the standard deviation of these difference scores. – Masato Nakazawa Aug 18 '14 at 18:44
• I can't do that because the data is paired in that way. I.e. it's not the same 3 cells each time. 3 cells were induced to fluoresce and another 3 were not. – Charon Aug 18 '14 at 18:53
• Then $\sqrt(s^2_X + s^2_Y)$. – Masato Nakazawa Aug 18 '14 at 19:01
• Sorry the data is not paired in that way, I meant to say. Therefore, does your answer still hold? – Charon Aug 18 '14 at 19:16
• It does. If they had been paired, the standard deviation would have been $\sqrt{s^2_X + s^2_Y -2cov(X,Y)}$, but hence they are not paired, cov(X,Y) = 0. – Masato Nakazawa Aug 18 '14 at 19:19

Basic properties of expectation and variance give us:

$$E[aX+bY] = aE[X]+bE[Y]$$

$$\text{Var}[aX+bY] = a^2\text{Var}[X]+b^2\text{Var}[Y]+2ab\text{Cov}[X,Y]$$

a) With $a=1,\,b=-1$ and assuming independence, we have

$$E[X-Y] = E[X]-E[Y]$$

$$\text{Var}[X-Y] = \text{Var}[X]+\text{Var}[Y]$$

Taking square roots yields the result for the standard deviation.

b) With $a=1,\,b=-1$ in the presence of dependence, we have

$$E[X-Y] = E[X]-E[Y]$$

$$\text{Var}[X-Y] = \text{Var}[X]+\text{Var}[Y]-2 \text{Cov}[X,Y]$$

It's not clear to me how the dependence is operating (your description doesn't make it clear which observations are correlated).

If two sets of means are dependent (as "pairs of means"), you could treat the means as paired data.

(Outside of that you might need to look at random effects/mixed effects models.)

• They are not independent though – Charon Aug 19 '14 at 9:34
• It's two samples of the same type of cell. The cells can be induced to fluoresce but, even without having been induced, they will fluoresce a little. One sample has been induced, the other not. Hence, the variables are not independent because if the uninduced fluorescence is high, it will have an effect on the induced fluorescence as well. – Charon Aug 19 '14 at 9:37
• See edits; feel free to expand on how the dependence is expected to work. – Glen_b -Reinstate Monica Aug 19 '14 at 10:54
• Well, as I see it, the fluorescence of the induced cells = background fluorescence + fluorescence as a result of inducement. The fluorescence of the uninduced cells = background fluorescence. Therefore, is the former not dependent on the latter? – Charon Aug 19 '14 at 11:28
• I don't see that this of itself implies dependence. If the (population mean) background is constant across observations, you would expect to have independence. Even if there's some random noise in the background (so all observations have some common, unknown random shift) then that effect is eliminated when you take the difference in means (so you can still treat them as independent). If there's variation in background that tends to make some observations more alike than others, that would imply some form of dependence that needs to be dealt with. – Glen_b -Reinstate Monica Aug 19 '14 at 12:09