So I having been using R to perform statistical analysis.
The 'lm' function is generally used to create a linear model, and this model can have degree 1 variables by using model= lm (y~ ., data= train)
Similarly degree 2 interaction can be done using model= lm(y~.*., data= train)
To apply regularization, the most preferred package seems to be glmnet, but glmnet can apply regularization only to the original dataset, and not to more complex polynomial models. Is there a way in R I can perform regularization to polynomial interaction terms of the original variables?
model.glmnet= glmnet(x= train[,1:4], y= train[,5], alpha=0)
P.S.- I do not wish to create those variables in the original dataset as that would be a very tedious task