本文介绍了拟合概率错误,数值为0或1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在R中构造一个广义线性模型.

I tried to construct a generalized linear model in R.

我在下面接收到以下输出,错误为发生了拟合概率,数值为0或1".我想知道这是由于完全分离造成的吗?我的截距和标准误差不是很大,我想知道这是由于其他原因引起的吗?

I receive the following output below with the error "fitted probabilities numerically 0 or 1 occurred". I am wondering is this due to complete separation?My intercepts and standard errors are not very large and I am wondering is this error due to something else?

best <- glm(y ~ p1 + p2 + p3, family = binomial)
glm.best: fitted probabilities numerically 0 or 1 occurred

推荐答案

大多数情况下,如果发生分离问题,就会发生该错误.要解决此问题,您可以使用Firth方法.在R Firth的方法中,是在 logistf 包中实现的: https://cran.r-project.org/web/packages/logistf/logistf.pdf#Rfn.logistf

Mostly the error occurs when there is a matter with separation.To overcome this issue you can use Firth's method. In R Firth's method is implemented in the logistf package:https://cran.r-project.org/web/packages/logistf/logistf.pdf#Rfn.logistf

这篇关于拟合概率错误,数值为0或1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-26 10:59