I have a problem with logistic regression.
I have the following variables:
Var1: 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 0 0 NA 1 0 0 1 0 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1
Var2: 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 0 1
Var1 is continuous (It doesn't seem continuous because of my data, but in my study I have similar variables with 2,3,4.....)
Var2 is categorical
When I do logistic regression
mylogit <- glm(Var2 ~ Var1, data = mydata, family = "binomial")
I obtain a p value of 0.994 but It's not true, because I think that my data should have a p value < 0.05 since I obtain a p value < 0.001 doing a t-test.
I think that my problem is that all "1" in Var2 match with a "1" in Var1.
I' have checked this post:
and I have tried all the methods described in this post and I never obtain a significant p value.
Perhaps my problem is different, I don't know.
What should I do to obtain a realistic p value with my data???
Thank you very much.
with(mylogit, 1-pchisq(null.deviance-deviance,df.null-df.residual))gives the p-value for your model vs the null. – Scortchi - Reinstate Monica Feb 23 '15 at 15:18exp(mylogit$coeff). If the result looks strange, examine a cross-tabulation of the variables & think about what 'odds' & 'odds ratio' mean. Examine the predictionsplot(predict(mylogit, type="response")). If you're unhappy with the estimates or predictions, read the post I linked to. – Scortchi - Reinstate Monica Feb 23 '15 at 17:26