Rescale predictions of regression model fitted on scaled predictors Let's say I fit a model to data that has been standardized to z-score form:
#load data
data(cars)

#standardize variables so that they have mean 0 and st. dev 1
st.cars <- scale(cars)
st.cars <- as.data.frame(st.cars)

mod <- lm(speed ~ dist,data=st.cars)

I would like to make predictions using this model:
predict(mod,st.cars), however, I would like to get the predictions on the original scale of the dependent variable in the dataset.
Is there a way to re-scale the predictions to the original scale?
 A: The scale function stores the scale and center values it uses to scale the data in an attribute. These can be used to convert predictions on the scaled data back to the original data scale.
# Scale cars data:
scars <- scale(cars)
# Save scaled attibutes:
scaleList <- list(scale = attr(scars, "scaled:scale"),
    center = attr(scars, "scaled:center"))
# scars is a matrix, make it a data frame like cars for modeling:
scars <- as.data.frame(scars) 
smod <- lm(speed ~ dist, data = scars)
# Predictions on scaled data:
sp <- predict(smod, scars)
# Fit the same model to the original cars data:
omod <- lm(speed ~ dist, data = cars)
op <- predict(omod, cars)
# Convert scaled prediction to original data scale:
usp <- sp * scaleList$scale["speed"] + scaleList$center["speed"]
# Compare predictions:
all.equal(op, usp)

If you want to use the model to predict new data with the smod model object, you will need to scale the newdata values using the appropriate values from the scaleList object (do not call the scale function on the newdata directly).
