I'm new to R and logistic regression and have to admit that I don't really know how to interpret the result. I'm trying to compute a pretty simple model with 2 predictors (A and B). When I first try to compute models with the predictors one by one they are both significant. When I put them together and add an interaction term they lose their significance (but the interaction term is weakly significant). I interpret this as A and B are overlapping and no longer significant when the oter parameter is hold constant. Right?
But now to the part I don't know how to interpret. I make predictions from my models (see code below) and then run t-tests for the predictions vs. the depending variable. I think this should give a hint on how good the model is (is there a better way?). When I do it this way I get a much lower p-value for the model with both A and B. I think this is contradictory. The first part tells me that A doesn't provide any significant information to the model when combined with B, but on the other hand I get much better predictions. I guess something is really wrong, but I can't figure out what. Can you help me?
model1=glm(f~A, , family=binomial(link="logit")) model2=glm(f~B, family=binomial(link="logit")) model3=glm(f~A*B, family=binomial(link="logit")) summary(model1) summary(model2) summary(model3) p1=predict(model1, newdata=data, type="response", na.rm=TRUE) p2=predict(model2, newdata=data, type="response", na.rm=TRUE) p3=predict(model3, newdata=data, type="response", na.rm=TRUE) t.test(p1~f) t.test(p2~f) t.test(p3~f)
Part of the output:
> summary(model1) Estimate Std. Error z value Pr(>|z|) (Intercept) -1.9756 0.3499 -5.647 1.64e-08 *** A -0.5898 0.2119 -2.784 0.00537 ** > summary(model2) Estimate Std. Error z value Pr(>|z|) (Intercept) 8.354e-01 1.309e+00 0.638 0.5234 B -1.028e-04 5.122e-05 -2.007 0.0447 * > summary(model3) Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 1.254e+00 1.705e+00 0.735 0.462 A 1.589e+00 9.743e-01 1.631 0.103 B -1.324e-04 7.333e-05 -1.805 0.071 . A:B -9.418e-05 4.632e-05 -2.033 0.042 * > t.test(p1~f) t = -2.614, df = 11.83, p-value = 0.02286 > t.test(p2~f) t = -1.8702, df = 15.679, p-value = 0.08024 > t.test(p3~f) t = -4.9777, df = 17.344, p-value = 0.0001084