R 安全二元回归:can';找不到导致分离的正确术语

R 安全二元回归:can';找不到导致分离的正确术语,r,logistic-regression,glm,R,Logistic Regression,Glm,根据safeBinaryRegression的文档,如果出现准分离或完全分离,包将屏蔽glm函数并发出错误消息。通过指定separation=“find”它将列出导致问题的预测值 然而,当我使用这个软件包并在我的数据上使用glm时,它无法正确地找到实际上是分离结果变量的唯一预测项 例如: y <- c(1, 0, 1, 1, 1, 1, 1, 1, 0, 0) x2 <- c(3, 2, 3, 1, 3, 1, 2, 2, 3, 3) x1 <- c(0, 0, 0, 1,

根据safeBinaryRegression的文档,如果出现准分离或完全分离,包将屏蔽glm函数并发出错误消息。通过指定
separation=“find”
它将列出导致问题的预测值

然而,当我使用这个软件包并在我的数据上使用
glm
时,它无法正确地找到实际上是分离结果变量的唯一预测项

例如:

y <- c(1, 0, 1, 1, 1, 1, 1, 1, 0, 0)
x2  <-  c(3, 2, 3, 1, 3, 1, 2, 2, 3, 3)
x1 <- c(0, 0, 0, 1, 1, 1, 0, 0, 0, 2)
x0 <- c(1, 0, 1, 0, 1, 0, 0, 0, 0, 0) # This causes separation

test.data <- cbind(y,x0,x1,x2)
test.data <- as.data.frame(test.data)

library(safeBinaryRegression)
glm(y ~ x0 + x1 + x2, data = test.data,  family=binomial, separation="find")
# Error in ... The following terms are causing separation among the sample points: (Intercept), x0, x1, x2
glm(y ~ x0, data = test.data,  family=binomial,  separation="find")
# Error in ... The following terms are causing separation among the sample points: (Intercept), x0
glm(y ~ x1, data = test.data,  family=binomial,  separation="find")
# No error message
glm(y ~ x2, data = test.data,  family=binomial,  separation="find")
# No error message
y