is it possible to do stepwise (direction = both) model selection in nested binary logistic regression in R? I would also appreciate if you can teach me how to get:
- Hosmer-Lemeshow statitistic,
- Odds ratio of the predictors,
- Prediction success of the model.
I used lme4 package of R. This is the script I used to get the general model with all the independent variables:
nest.reg <- glmer(decision ~ age + education + children + (1|town), family = binomial, data = fish)
- fish -- dataframe
- decision -- 1 or 0, whether the respondent exit or stay, respectively.
- age, education and children -- independent variables.
- town -- random effect (where our respondents are nested)
Now my problem is how to get the best model. I know how to do stepwise model selection but only for linear regression. (
step( lm(decision ~ age + education + children, data = fish), direction +"both")). But this could not be used for binary logistic regression right? also when i add
(1|town) to the formula to account for the effects of town, I get an error result.
By the way... I'm very much thankful to Manoel Galdino who provided me with the script on how to run nested logistic regression.
Thank you very much for your help.