使用逻辑回归的p值的NaN

时间:2020-01-18 23:58:14

标签: python logistic-regression p-value hessian

我无法正确执行逻辑回归。 尽管我的数据集没有关联,但我遇到了诸如“奇异矩阵”之类的错误,但出现了Hessian问题。

这3个代码都无法顺利运行:

>

 model = sm.Logit(y1,X1.astype(float))

> 1. #result = model.fit(method='bfgs')
> #result.summary() 

> 2. #result = model.fit(method='powell') result.summary()

> 3. #result=model.fit_regularized
>    #result.params

ValueError:将熊猫数据强制转换为对象的numpy dtype。使用np.asarray(data)检查输入数据。

使用鲍威尔(Powell)方法或bfgs方法时,p值变为“非”。

#define the response (y) and predictors (X)
X1 = df1.loc[:, df.columns != 'OPENED']
y1 = df1['OPENED']
model = sm.Logit(y1,X1.astype(float))
result = model.fit(method='powell')
result.summary()

enter image description here

有什么想法吗?

要检查什么?使用什么?谢谢。

0 个答案:

没有答案