我有一个看起来像这样的数据框:
df:
ColA ColB
A 0.78
B 0.91
C 0.36
D 0.67
E 0.88
代码:
p1_logit_model=sm.MNLogit( df["ColA"], df["ColB"].astype(float) )
res_p1 = p1_logit_model.fit(full_output= True)
f.write(str(res_p1.summary2()))
当我看到输出时,我发现,它并没有返回所有类别的结果,即ColA有5个唯一的类别,但是我只有4个结果:
输出:
===============================================================
Model: MNLogit Pseudo R-squared: 0.104
Dependent Variable: algorithm AIC: 184.2255
Date: 2018-12-18 19:14 BIC: 194.2622
No. Observations: 55 Log-Likelihood: -87.113
Df Model: 0 LL-Null: -97.227
Df Residuals: 50 LLR p-value: nan
Converged: 1.0000 Scale: 1.0000
No. Iterations: 9.0000
--------------------------------------------------------------
algorithm = 0 Coef. Std.Err. t P>|t| [0.025 0.975]
--------------------------------------------------------------
ColB 0.2326 0.5804 0.4008 0.6886 -0.9050 1.3702
--------------------------------------------------------------
ColA = 1 Coef. Std.Err. t P>|t| [0.025 0.975]
--------------------------------------------------------------
ColB -6.3891 3.9519 -1.6167 0.1059 -14.1346 1.3565
--------------------------------------------------------------
ColA = 2 Coef. Std.Err. t P>|t| [0.025 0.975]
--------------------------------------------------------------
ColB -1.8283 0.9722 -1.8805 0.0600 -3.7339 0.0772
--------------------------------------------------------------
ColA = 3 Coef. Std.Err. t P>|t| [0.025 0.975]
--------------------------------------------------------------
ColB -0.3208 0.6488 -0.4943 0.6211 -1.5925 0.9510
--------------------------------------------------------------
===============================================================
这里的结果应为ColA = 4,因为有5个唯一的类别。谁能帮我这个忙。