I want to run a lasso and ridge regression for a out of sample predictions of wages.
I have 13 explanatory variables and want generate all possible interactions terms and also maybe ^2 them order ^3 them and so on till maybe ^5. I also want to ^2 t and ^3 and so on the explanatory variables on there own.
Is there a possible way to do this automatically?
With for example model.matrix(y~(V1+V2+V3)^2, dataFrame)
I get interactions therms but they are not ^2
only v1*V2 + V1*V3 + V2*V3
. I also want (V1*V2)^2
maybe and so on.