I want to build regression model (linear and logit) but one of my independent variables is categorical variable with levels "Gym", "School", "Hospital", "Others". How to incorporate this variables in my model (in R)? Should I convert this variable to dummy variables ("School_dummy", "Hospital_dummy" and "Gym_dummy", without "Others_dummy") or there is another solution? And what if I omit "Gym_dummy" instead of "Others_dummy"? Is it okay or the model is harder to interpret? Because then I want to use step procedure based on AIC criterion in order to choose the most important variables, so it is possible that I end for example only with "Hospital_dummy" in my final model.
Assuming you're using the base R
If you createthe dummy variables yourself, the step process will treat them as separate variables, so you may get some of them removed while the others remain in the model.
You can also feed them into the model as categorical and R will do the dummification for you. When executing
step, either the variable stays or is removed altogether, but you won't run into the problem of having only some of the dummy variables in the final model.