How to convert coefficients from quadratic function from scaled to not scaled coefficients? I'm running a linear model with a quadratic function and I want to transform the data. But I noticed that the data transformation is affecting the coefficient estimates of the linear model. 
For example, that this problem: 
Here I generate some data that will have a mean of 5.5 
x = seq(1,10,by = 0.01)
mu = mean(x) # mean = 5.5 
sg = sd(x) 
y = 1 + 2*(x) + 3*(x)^2 # Quadratic response

plot(y~I((x)), type= "l");       abline(v = 0,h = c(0,1, 102.7), lty = 3)
lm.out = lm(y ~ x + I((x)^2))
lm.out
# Coefficients:
#   (Intercept)            x     I((x)^2)  
            # 1            2            3  


The model estimates correctly the data. 
With the exact same data I plot the x value standardized. 
plot(y~I((x-mu)/sg), type= "l"); abline(v = 0,h = c(0,1, 102.7), lty = 3)
x = scale(x)
lm.out2 = lm(y ~ x + I((x)^2))
lm.out2
# Coefficients:
#   (Intercept)            x     I((x)^2)  
        # 102.75        91.08        20.32  


The intercept make sense, but why are the linear and quadratic coefficients so different? (Sure it's because the Y values were estimated with x and not scale(x)). So, how to transform them back to the original data? 
So I came back to the original data and tried to estimate the quadratic regression with a translation (with the mean of X). 
x = seq(1,10,by = 0.01)
lm.out3 = lm(y ~ I((x)) + I((x-mu)^2))
lm.out3
# Coefficients:
#   (Intercept)         I((x))  I((x - mu)^2)  
       # -89.75          35.00           3.00  

My question is: 
From: 
lm.out2
# Coefficients:
#   (Intercept)            x     I((x)^2)  
        # 102.75        91.08        20.32  

is it possible to get this: 
lm.out
# Coefficients:
#   (Intercept)            x     I((x)^2)  
            # 1            2            3  

 A: Yes it is possible if you save the original mean and standard deviation of $x$. Say your original model is,
$$
y = \beta_0 + \beta_1 x + \beta_2x^2
$$
Let's denote the standardized version with stars. You are making the transformation $x^* = \frac{x - \mu_{x}}{S_x}$, where $\mu_{x}$ is the mean of $x$ and $S_{x}$ the standard deviation of $x$. Thus using algebra, your new model is,
$$
\begin{align}
y &= \beta_0^* + \beta_1^*x^* + \beta_2^*x^{*2}\\
&= \beta_0^* + \beta_1^* \left(\frac{x - \mu_{x}}{S_x}\right) + \beta_2^*\left( \frac{x - \mu_{x}}{S_x}\right)^2  \\
&= \left(\beta_0^* - \frac{\beta_{1}^*\mu_{x}}{S_{x}} + \frac{\beta_{2}^*\mu_{x}^2}{S_{x}^2}\right) + \left(\frac{\beta_1^*}{S_{x}} - 2\frac{\beta_2^*\mu_{x}}{S_{x}^2} \right)x + \left(\frac{\beta_2^*}{S_{x}^2}\right)x^2
\end{align}
$$
Thus, you can recover your original parameters with,
$$
\begin{align}
\beta_0 &= \left(\beta_0^* - \frac{\beta_{1}^*\mu_{x}}{S_{x}} + \frac{\beta_{2}^*\mu_{x}^2}{S_{x}^2}\right) \\
\beta_1 &= \left(\frac{\beta_1^*}{S_{x}} - 2\frac{\beta_2^*\mu_{x}}{S_{x}^2} \right)\\
\beta_2 &= \left(\frac{\beta_2^*}{S_{x}^2}\right)
\end{align}
$$
So the answer using the code: 
coef(lm.out2)[1] - coef(lm.out2)[2]*mu/sg + coef(lm.out2)[3]*mu^2/(sg^2)
coef(lm.out2)[2]/sg -2*coef(lm.out2)[3]*mu/(sg^2)
coef(lm.out2)[3]/(sg^2)

