title: How to undo log transformation after prediction in R?
body: <p>I've applied multivariate linear regression to my logarithmic transformed dependent feature. Four of the 30 independent features are also log transformed.  I want to undo the log transformation after the prediction, however, because it would be easier to interpret the RMSE and MAE scores when the features are not log transformed. I can't seem to figure out how this works however. </p>
  
  <p>This is how the code for the model looks like:</p>
  
  <pre><code>m1 &lt;- lm(Feature.logtransformed ~., data = trainset)
  </code></pre>
  
  <p>And this is the code I'm using to obtain the RMSE score of my model: </p>
  
  <pre><code>rmse &lt;- function(model){
    y = trainset$Feature.logtransformed
    y.pred = predict(model, trainset) 
    return(sqrt(mean((y - y.pred)^2)))
  }
  
  rmse(m1)
  </code></pre>
  
  <p>I thought of doing something like this:</p>
  
  <pre><code>rmset &lt;- function(model){
    y = trainset$Feature.logtransformed
    y = y - exp(y)
    y.pred = predict(model, trainset)
    return(sqrt(mean((y - y.pred)^2)))
  }
  </code></pre>
  
  <p>I used this code to transform the features:</p>
  
  <pre><code>df$Feature.logtransformed &lt;- log(df$Feature.logtransformed + 1 )
  </code></pre>
  
  <p>But this does not seem to give good results? If anyone could help, I'd really appreciate it! </p>