I have a large dataset of medical insurance claims on which I want to apply GLM regression. I have 4 categorical predictor variables specifically Gender, Age groups, Nationality, and Room Type (VIP, normal etc).
My basic GLM model will include the intercept term and these 4 variables. I now want to introduce two-way interactions but I am not certain about which interactions are significant for the model and which are not. For this purpose, I want to run all possible combinations of the interactions along with the 4 base predictors and then compare all the model results based on a certain characteristic such as AIC or BIC or R-square.
I want to know if there is a function or an easy way in R to run all the possible interactions and save their AIC/BIC/R-square without having to write down the glm function for each possible model.
A few examples of the models to run would be:
1. intercept + Gender + Age + Nationality + RoomType
2. intercept + Gender + Age + Nationality + RoomType + gender*age
3. intercept + Gender + Age + Nationality + RoomType + gender*nationality
4. intercept + Gender + Age + Nationality + RoomType + gender*roomtype
5. intercept + Gender + Age + Nationality + RoomType + age*nationality
6. intercept + Gender + Age + Nationality + RoomType + age*roomtype
7. intercept + Gender + Age + Nationality + RoomType + nationality*roomtype
8. intercept + Gender + Age + Nationality + RoomType + gender*age + gender*nationality
and so on.