# Why both data have same standard deviation?

But I am curious why the standard deviation for both data is same. I think because data 2 is "100 - data 1".

• $var(X+a)=var(X)$ and $var(aX)=a^2var(X)$ for a real number $a$ and a random variable $X$. With those, can you prove why $var(100-X)=var(X)$ where X is your data set? (Equal variances is the same as equal standard deviations.)
– Dave
Commented Feb 15, 2020 at 0:24

I still would like you to try to prove it, but I’ll give some intuition about those two identities I gave.

Remember that variance (and standard deviation) have something to do with how spread out your data are.

$$var(X+a)=var(X)$$ means that if you take data with some amount of spread and slide them up or down the number line, you do not change the spread.

$$var(X)=var(-X)$$ is not quite what I gave, but it’ll be part of your proof. The intuition here is that you’re just spinning it around, taking a mirror image. The data are as spread out as their reflection.

Together, $$var(100-X)=var(X)$$ means that you flip the data to the mirror image and then slide along the number line, but you do not change the spread.

Capisce?

• what is the meaning of Capisce?
– aan
Commented Feb 16, 2020 at 11:41
• that's Italian for "do you comprehend ?" Commented Feb 16, 2020 at 13:20

I believe the answer to this question can be expressed in more elemental terms. Beginning with the formula for the sample standard deviation

$$s_{x} = \sqrt{\frac{ \sum_{i=1}^{n}{(x_i - \overline{x})^2} }{n - 1}},$$

I want to draw your attention to the expression $$(x_i - \overline{x})$$ in the numerator. Ignore the summation notation for the purposes of this answer. Note, we decrement the sample mean (i.e., $$\overline{x}$$) from each realization of $$x_{i}$$. If we were to increase or decrease each $$x_{i}$$ by the same amount, the mean will change. However, the distance of each realization of $$x_{i}$$ from that central tendency remains the same. In other words, each deviation from the mean is the same.

Subtracting each $$x_{i}$$ from a constant (e.g., $$100 - x_{i}$$) flips the vector of values to its mirror image, then slides it along the number line by a constant amount. Suppose the first realization of $$x_{1}$$ = 20 and $$\overline{x}$$ = 4. In keeping with the foregoing expression,

$$(20 - 4) = 16,$$

which is the deviation from the sample mean. Now, assume we don't move along the number line just yet and we simply put a negative sign in front of each $$x_{i}$$, such that we have $$-(x_{i})$$; this flips the sign of the mean as well. The first realization, $$x_{1}$$, is now $$-20$$. Again, substituting $$-20$$ into the expression,

$$(-20-(-4)) =-16,$$

which is the same number of units away from the mean. Note, squared deviations result in a positive number, so the numerator remains the same. You can run this code in R which builds upon @knrumsey's insightful response, but breaks it down further:

x <- rnorm(10000, 30, 5) # Simulates 10,000 random deviates from the normal distribution

par(mfrow = c(2, 2))
hist(x, xlim = c(0, 100), col = "blue")
hist(-x, xlim = c(-100, 0), col = "red")  # Note the -x, it simply flips the sign (mirror image)
hist(x, xlim = c(0, 100), col = "blue")
hist(100-x, xlim = c(0, 100), col = "red")  # Subtracting x from 100 shifts values along the x-axis


The first row of plots shows how the realizations translate when we negate each $$x_{i}$$. The second row shows what happens when each $$x_{i}$$ is subtracted from 100; the translation first flips then slides across the number line. The spread of the distribution is unaffected by this.

To supplement @Dave's answer, take a look at the following histograms which have the same x-axis. Data2 is just a shifted version of Data1 and therefore the standard deviation, which is a measure of spread, shouldn't change.

R code to generate histograms:

x <- 100*rgamma(1000, 6, 2) #Simulate some data
hist(x, xlim=c(0,100))
hist(100-x, xlim=c(0,100))

• Thanks. well-plotted histogram. May I know how do you plot the histogram?
– aan
Commented Feb 15, 2020 at 5:29
• @aan see the update. Commented Feb 15, 2020 at 17:49
• @knrumsey Good illustration. However, simulating from the gamma distribution would produce realizations that cluster around a mean that is much lower than what I see here given the parameters you specified. Right? Commented Feb 16, 2020 at 20:24
• @Tom, that is correct. I didn't put too much thought into which distribution I simulated from. Just wanted draws between 0 and 100. Commented Feb 16, 2020 at 20:45
• @Thomas Bilach, realizing that I misunderstood your question. Thanks for pointing this out, I've updated the post to reflect the fact that I multiplied the data by 100. Commented May 3, 2020 at 0:48

changes period to period in DATA 1 identical to the negative changes in DATA 2

OBS DATA 1 FIRST DIF DATA 2 FIRST DIFF

1 30 NA 70 NA

2 40 10 60 -10

3 80 40 20 -40

4 30 -50 70 50

5 20 -10 80 10

6 33 13 67 -13

7 33 0 67 0

8 33 0 67 0

9 33 0 67 0

CONTINUING STEPS TO UNCOVER THE BASIC RELATIONSHIP OF DATA1 AND DATA2:

I took the series DATA1 and computed the ACF ... here it is ..

AND for DATA2 here

...note that not only are the standard deviations the same but the ACF's are the same.

• This is an interesting perspective, but I believe it would need more explanation to be understood by many readers.
– whuber
Commented Feb 15, 2020 at 22:53
• @IrishStat, thanks. do you mind to explain more?
– aan
Commented Feb 16, 2020 at 11:42
• i added some material to my response detailing how differenced data period to period ( val2-val1,val3-val2,.. val9-val8) for both original series DATA1 and DATA2 were complements of each other Commented Feb 16, 2020 at 13:19
• @IrishStat. Noted. what is the meaning of Q.E.D and OBS?
– aan
Commented Feb 16, 2020 at 15:58
• An explicit connection between those assertions and the result is needed. What is interesting is your use of successive differences ("changes period to period" in an otherwise unordered dataset) to characterize the standard deviation of the dataset. In other words, you appear to be claiming that the set of equalities $$x_{i+1}-x_i = -(y_{i+1}-y_i)$$ for $i=1, 2, \ldots, n-1$ implies $$\sum_{i=1}^n(x_i-\bar x)^2=\sum_{i=1}^n(y_i-\bar y)^2.$$ That's true, but it does need to be shown: you can't just exhibit a table of numbers and declare "QED"!
– whuber
Commented Feb 16, 2020 at 20:15