I'm doing logistic regression in R with binary data (0's and 1's), sample size around 300 : Predicting 1 target variable (varp)
If I use one independent variable ( varx), it's significant (p 0.03, the AIC is 200) : glm(formula = varp ~ varx, family = binomial, data = mydata)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.0251 0.2215 -4.681 0.00000245 ***
indepvar1 -0.6551 0.3612 -2.118 0.0322 *
Dispersion parameter for binomial family taken to be 1)
Null deviance: 211.06 on 205 degrees of freedom
Residual deviance: 206.36 on 204 degrees of freedom
AIC: 200
But when I use multiple independent variables of interest the AIC becomes 170, glm(formula = varp ~ varx+varb+vargg+varkkk...., family = binomial, data = mydata)
How to select the model ( the one with 1 var or the group of vars) that best predict the varp ?:
- the model with One independent variable (varx) with AIC 200 , or
- a group of variables with AIC 170, in this group, the varx becomes non significant and instead another one is significant ...