I have to do a LASSO regression model including a lot of predictor variables. How can I include all the predictor variables and the one way interactions between the predictor variables to my model?
I am currently using this function, however it seems to remove a lot of rows from my data which I am not so sure why this happens. When I try to run a bootstrap on this, it gives me an error saying the rows of y and x don’t match. I have searched a lot of sources but can’t seem to find any function that works for me.
x <- model.matrix(~ .^2, data = data[, predictorvariables])[,-1]
A ZZZ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.