I am attempting to construct a Linear Model based on a large number of explanatory variables (including interaction terms between variables) two of which are factor variables. Using a factor variable in either regsubsets() or leaps() causes an error. Is there another function or package I can use that will incorporate factor variables when attempting exhaustive model selection?
Thank You
James
I’ve had the same issue when setting up the
leaps()orregsubsets()using the x and y matrices.However,
regsubsets(y~x1cont+factor(x2)..., data=data)works for me. No error. Perhaps that may work for you?