5
$\begingroup$

I have a dataset with 10 variables ...is it feasible to transform each variable differently while doing multiple regression...

for example
new_V1 = log(v1)

New_V2= V2^2

New_V3= 1/V3

Likewise differently for different variables and then applying multiple regression?

$\endgroup$
  • 2
    $\begingroup$ Feasible yes; sensible very often. Note that a simple case is having (together with others) binary predictors (indicator or dummy variables), in which case no transformation makes sense (and not transforming makes sense). $\endgroup$ – Nick Cox May 11 '15 at 8:26
  • 2
    $\begingroup$ Feasible in what sense? Certainly it's possible. $\endgroup$ – Glen_b -Reinstate Monica May 11 '15 at 10:56
8
$\begingroup$

Yes. Sure. The key is to understand that in the expression "linear regression" the word "linear" means "linear with respect to the coefficients in front of variables". So, you can not only transform each variable differently, but, for example, make two different transformations of each variable and include both in regression. You should keep in mind, however, that ideally your variables should be uncorrelated with each other and roughly on the same scale.

If you are using R, you can transform variables directly in the formula without changing the data frame

lm(y ~ I(log(v1)) + I(v2^2) + I(1/v3), data=data)

In this case, if you want to make predictions for another data frame newdata, you can use it directly (without changing it).

Alternatively you can transform variables "by hand" in the data frame (introduce new columns with or without eliminating the old columns) and work with new variables

lm(y ~ new_v1 + new_v2 + new_v3, data=data)

To make predictions in this case, you need to transform variables in your newdata data frame (that is, introduce new columns) in the same way you transformed it in data.

The results of these two "implementations" will be the same. And both are linear regression.

$\endgroup$
  • $\begingroup$ So my reg equation will be =Intercept+coef * antilog(new_v1)+coef * (sqrt(new_v2))+coef * new_V3 $\endgroup$ – Shubham. May 11 '15 at 7:54
  • $\begingroup$ No. Your regression equation will be = intercept + coef_1*new_V1 + coef_2*new_V2 + coef_3*new_V3 $\endgroup$ – lanenok May 11 '15 at 7:58
  • $\begingroup$ Y arent we considering the variable modification we did earlier.? $\endgroup$ – Shubham. May 11 '15 at 8:05
  • $\begingroup$ What do you mean with "did earlier"? You do not transform your variables back. Consider creating new variables as creating new data frame with this (=new) variables only $\endgroup$ – lanenok May 11 '15 at 8:08
  • 3
    $\begingroup$ Useful, but OP did not indicate use of R (if that is the software you are presuming) and many people interested in this will not be using R. A statistical answer is best phrased using statistical notation, not software instructions. $\endgroup$ – Nick Cox May 11 '15 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.