Suppose I have a simple linear model in r of the form linear_mod <- lm(log(target) ~ a + b + c)
.
I am able to predict() with this model by predicting on my training data, back transforming the prediction results for log(target)
using exp()
and then manually calculating an evaluation metric such as RMSE.
I wondered if there's any framework or setting I can use to tell r to backtransform automatically, like when I call summary(linear_mod)
where r returns the RMSE as well as R squared.
Is there a package (e.g. caret?) that can accept as a argument whether or not to back transform the target variable when using a transformation? Or must I do this manually, perhaps by creating a function?