# Transform Data to Desired Mean and Standard Deviation

I am looking for a method to transform my dataset from its current mean and standard deviation to a target mean and a target standard deviation. Basically, I want to shrink/expand the dispersion and scale all numbers to a mean.

It doesn't work to do two separate linear transformations, one for standard deviation, and then one for mean. What method should I use?

Could the solution possibly be applied to an example where a point 1.02 in a dataset with SD .4 and a mean 0.88 is transformed when I adjust the mean of the dataset to 0.5 and the SD to 0.1667? What is the new value of the point?

• If $Y = aX + b$, then $E(Y) = a E(X) + b$ and $Var(Y) = a^2 Var(X)$. Does this help? – ocram Dec 22 '12 at 9:00
• @ocram, I think that's an answer (and a good one)... – Peter Ellis Dec 22 '12 at 10:09
• @PeterEllis: Thanks! I'll make it an answer then :-) – ocram Dec 22 '12 at 10:20
• @ocram Thanks much for your answer, and I sense it's what I need. But could you provide an example calculation? Quite frankly, I have very little statistics background. I will edit my post to have more detail – Wagtail Dec 22 '12 at 10:23

Suppose you start $\{x_i\}$ with mean $m_1$ and non-zero standard deviation $s_1$ and you want to arrive at a similar set with mean $m_2$ and standard deviation $s_2$.
Then multiplying all your values by $\frac{s_2}{s_1}$ will give a set with mean $m_1 \times \frac{s_2}{s_1}$ and standard deviation $s_2$.
Now adding $m_2 - m_1 \times \frac{s_2}{s_1}$ will give a set with mean $m_2$ and standard deviation $s_2$.
So a new set $\{y_i\}$ with $$y_i= m_2+ (x_i- m_1) \times \frac{s_2}{s_1}$$ has mean $m_2$ and standard deviation $s_2$.
You would get the same result with the three steps: translate the mean to $0$, scale to the desired standard deviation; translate to the desired mean.