Predicting Transformed Dependent Variable

Live Online Training : Data Science with R

- Explain Advanced Algorithms in Simple English
- Live Projects
- Case Studies
- Job Placement Assistance
- Get 10% off till Oct 26, 2017
- Batch starts from October 28, 2017

In linear regression models, we generally transform our dependent variable to treat heteroscedasticity, non-normality of errors and non-linear relationship between dependent and independent variables.

To calculate the 'real' predicted value, we need to perform 'back transformation'.
  1. Natural Log (base e) Transformation - The back transformation is to raise e to the power of the number; If the mean of your base-e log-transformed data is 2.65, the back transformed mean is exp(2.65)=14.154
  2. Log base 10 Transformation - The back transformation is to raise 10 to the power of the number; If the mean of your base-10 log-transformed data is 2.65, the back transformed mean is 10^(2.65)=446.68
  3. Square Root Transformation - The back transformation is to square the number.
  4. Inverse (Reciprocal) Transformation - The back transformation is to inverse the number.
R Code : Back Transformation
#Build Linear Regression Model
fit = lm(log(mpg) ~ ., data=mtcars)
pred = predict(fit,mtcars)
Natural Log Transformed Data - Back Transformation 
Comparison of Linear Model and Log Transformed Model

It is not appropriate to compare linear model with transformed linear model in terms of their fit statistics (RMSE and R2), when their dependent variables were transformed so that units changed, as fit statistics are not comparable.
Comparing R-squared's in this case is like comparing two individuals, A and B, where A eats 65% of a carrot cake and B eats 70% of a strawberry cake. The comparison does not make sense because there are two different cakes.
One way : Perform back-transformation and then calculate RMSE and R2 manually on 'real' actual and 'back transformed' predicted values.

R Tutorials : 75 Free R Tutorials

Statistics Tutorials : 50 Statistics Tutorials

About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has close to 7 years of experience in data science and predictive modeling. During his tenure, he has worked with global clients in various domains like retail and commercial banking, Telecom, HR and Automotive.

While I love having friends who agree, I only learn from those who don't.

Let's Get Connected: Email | LinkedIn

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "Predicting Transformed Dependent Variable"

Post a Comment

Next → ← Prev