Pass reference parameter fr MNLogit

时间:2018-12-19 11:32:02

标签: python logistic-regression statsmodels mlogit

I have applied Logistic regression and I want to pass the reference object manually

  Algorithm         Success
    A                 0.91
    B                 0.98
    C                 0.76
     .
     .
     .
    B                 0.77
    C                 0.68
    D                 0.43
    E                 0.81

Code:

 p1_logit_model=sm.MNLogit(group["Algorithm"], group["Success"].astype(float))

 res_p1 = p1_logit_model.fit(full_output= True)
 f.write(str(res_p1.summary2()))

Output:

       Results: MNLogit
===============================================================
Model:              MNLogit          Pseudo R-squared: 0.104 

  Dependent Variable: algorithm        AIC:              184.2255

Date:               2018-12-18 17:19 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]
 --------------------------------------------------------------
  p1_less100ms      0.2326   0.5804 0.4008 0.6886 -0.9050 1.3702
  --------------------------------------------------------------
  algorithm = 1   Coef.  Std.Err.    t    P>|t|   [0.025  0.975]
   --------------------------------------------------------------
  p1_less100ms   -6.3891   3.9519 -1.6167 0.1059 -14.1346 1.3565
  --------------------------------------------------------------
   algorithm = 2   Coef.  Std.Err.    t    P>|t|   [0.025 0.975]
  --------------------------------------------------------------
  p1_less100ms    -0.3208   0.6488 -0.4943 0.6211 -1.5925 0.9510
  --------------------------------------------------------------
 algorithm = 3   Coef.  Std.Err.   t    P>|t|   [0.025 0.975]
 --------------------------------------------------------------
 p1_less100ms      0.2604   0.5776 0.4508 0.6521 -0.8716 1.3924

The Logit() by default assumes the last category ('E') as reference parameter to compare againest all, However, I want to pass the category MANUALLY eveytime

Can anyone help me with this

0 个答案:

没有答案