R: conditional binary logistic regression - Syntax and debugging

时光总嘲笑我的痴心妄想 提交于 2019-12-25 07:29:06

问题


From my talks with experts here (Link1, Link2), I think I need to do a conditional binary logistic regression. I have sorted my data in a way that each control is exactly followed by the counterpart treatment case and the data is in long format.

My design is detailed in the above two links plus these two more links: Link3, Link4

edit: later I saw that sorting is not at all important because the sorted and non-sorted data resulted in the same output.

My syntax is the following. The code runs but the result is so strange. Most SEs are zero and most P values are NaN. What is wrong?

library(Epi)

clogistic((DV ~ (Demo1 +Demo2 +Demo3 +Demo4 +Demo5)^2), 
          strata = PatientID,  data = Data4)

The output is:

> clogistic((DV ~ (Demo1 +Demo2 +Demo3 +Demo4 +Trt)^2), strata = PatientID,  data = MixedModelData4)

Call: 
clogistic(formula = (DV ~ (Demo1 + Demo2 + Demo3 + Demo4 + Trt)^2), 
    strata = PatientID, data = MixedModelData4)




                 coef exp(coef) se(coef)         z   p
Demo1        0.00e+00  1.00e+00        0       NaN NaN
Demo2        0.00e+00  1.00e+00        0       NaN NaN
Demo3       -3.27e-09  1.00e+00    56013 -5.83e-14   1
Demo4        0.00e+00  1.00e+00        0       NaN NaN
Trt         -2.12e+01  6.19e-10    14786 -1.43e-03   1
Demo1:Demo2  0.00e+00  1.00e+00        0       NaN NaN
Demo1:Demo3  0.00e+00  1.00e+00        0       NaN NaN
Demo1:Demo4  0.00e+00  1.00e+00        0       NaN NaN
Demo1:Trt   -4.34e-08  1.00e+00    50351 -8.62e-13   1
Demo2:Demo3  0.00e+00  1.00e+00        0       NaN NaN
Demo2:Demo4  0.00e+00  1.00e+00        0       NaN NaN
Demo2:Trt   -1.19e-08  1.00e+00    12937 -9.20e-13   1
Demo3:Demo4  0.00e+00  1.00e+00        0       NaN NaN
Demo3:Trt    8.08e-09  1.00e+00    19595  4.12e-13   1
Demo4:Trt   -1.62e-08  1.00e+00    31612 -5.12e-13   1

Likelihood ratio test=13.9  on 15 df, p=0.536, n=20
Warning message:
In clogistic((DV ~ (Demo1 + Demo2 + Demo3 + Demo4 + Trt)^2), strata = PatientID,  :
  Iteration limit exceeded

回答1:


When coefficients or their standard errors "blow up" it usually indicates a pathological data situation. Complete separation or serious muli-collinearity (or both) may exist. You need to provide both:

 str(MixedModelData4) 

and:

with( MixedModelData4, table(DV,Demo1, Demo2) )
with( MixedModelData4, table(DV,Demo1, Demo3))
with( MixedModelData4, table(DV,Demo1, Demo3))
with( MixedModelData4, table(DV,Demo1, Demo4))
with( MixedModelData4, table(DV,Demo1, Demo5))

And that's just for starters. The problem could exist in one of the other three way combinations that are in your data.



来源:https://stackoverflow.com/questions/18494133/r-conditional-binary-logistic-regression-syntax-and-debugging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!