1

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:

https://stackoverflow.com/questions/8596160/why-am-i-getting-algorithm-did-not-converge-and-fitted-prob-numerically-0-or

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.

Pol
  • 11
  • 1
  • 1
    You're quite right about the cause of the problem. You have separation & the Wald standard errors are unreliable. The likelihood-ratio test `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:18
  • That works perfectly but I also need the intersection and the slope (I need the odd ratios). Do you Know how to obtain them with my data. – Pol Feb 23 '15 at 16:43
  • 1
    Exponentiate the coefficients `exp(mylogit$coeff)`. If the result looks strange, examine a cross-tabulation of the variables & think about what 'odds' & 'odds ratio' *mean*. Examine the predictions `plot(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

0 Answers0