Transformation of variables in regression

5 views (last 30 days)
hdiba on 11 Nov 2016
Answered: Ahmet Cecen on 11 Nov 2016
Hi everybody, I have a question on multiple linear regression. I'd like to check several transformations of my independent variables (for example 1/x, x^2, sqrt(x)) in order to get a better adjusted r2. i have 5 independent variables (x1, x2, x3, x4, x5) and i would like to check the impact of different transformations at the same time. for example, one possibility would be y=1/x1+x2*x2+x3*x3+sqrt(x4)+1/x5.
in the end, the output would be the best fitted model.(crieterion=adjr2) can anyone help? thanks a lot

Answers (1)

Ahmet Cecen
Ahmet Cecen on 11 Nov 2016
You can use my MultiPolyRegress.
Now this deviates from your parameters a little.
1) The code is limited to standard polynomial bases with minor modifications. But you can use 90% of the code with some manipulation for other transformations as well.
2) The code doesn't calculate adjusted R square, but calculates Leave One Out Cross Validated metrics automatically. You can use it for overfitting detection by comparing how close the RSquare is to CV_RSquare (closer the better).

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by