I have 2 regressions I'm trying to evaluate, both are based on the same data, but the second regression has log transformation:
reg<-lm(AmountSpent~Age+Children+Catalogs+Gender+Married+Location+Salary,data=train.df) summary(reg) pred.train<-predict(reg) library(forecast) accuracy(pred.train,train.df$AmountSpent) pred.valid<-predict(reg,newdata = valid.df) accuracy(pred.valid,valid.df$AmountSpent)
reg.log<-lm(log(AmountSpent)~Age+Children+Catalogs+Gender+Married+Location+log(Salary),data=train.df) summary(reg.log) pred.train.log<-predict(reg.log) accuracy(exp(pred.train),train.df$AmountSpent) pred.valid.log<-predict(reg.log, newdata = valid.df) accuracy(exp(pred.log),valid.df$AmountSpent)
The questions I have are regarding the second regression:
- Is it okay to use log only on one (or some) independent variables, while the rest of the variables remains the same?
- When I use accuracy(exp- it changes the value only for variables with log, or changes the value for all variables in the regression?
- Do I need to use the exp function on both the prediction and validation or just the validation?