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
: Phalcon\Cache\Backend\File::save(): Only 0 of 33085 bytes written, possibly out of free disk space in /home/queryxchang/public_html/public/index.php on line 37
Cache file /home/queryxchang/public_html/apps/frontend/config/../cache/-q-20-314253-l1-and-l2-regularization-for-polynomial-regression-in-r- could not be written