I have a explanatory variable that is centered using scale() that is used to predict a response variable:
d <- data.frame(
x=runif(100),
I came across this problem and I think I found a simpler solution using linear algebra.
# create matrix like object
a <- rnorm(1000,5,2)
b <- rnorm(1000,7,5)
df <- cbind(a,b)
# get center and scaling values
mean <- apply(df, 2, mean)
sd <- apply(df, 2, sd)
# scale data
s.df <- scale(df, center = mean, scale = sd)
#unscale data with linear algebra
us.df <- t((t(s.df) * sd) + mean)