使用logistic回归分析pvalues的NaN

2024-06-08 00:53:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我不能正确地进行逻辑回归。 我有一些错误,比如“奇异矩阵”,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数据类型。使用np.asarray(数据)检查输入数据

用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

有什么想法吗

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


Tags: 数据方法modelresultsummaryfloatmethodfit

热门问题