I am trying to get a particular value from:
result = logit.fit()
print result.summary()
Logit Regression Results
==============================================================================
Dep. Variable: y No. Observations: 8039
Model: Logit Df Residuals: 8033
Method: MLE Df Model: 5
Date: Tue, 15 Sep 2015 Pseudo R-squ.: 0.01873
Time: 10:54:35 Log-Likelihood: -1851.0
converged: True LL-Null: -1886.4
LLR p-value: 7.422e-14
I want to get the value from converged (For above it is True
)
I could not find a way to get that value out of summary.
Is there a way to get whether the model was converged or not?
The additional information provided by the optimization routine are stored in mle_retvals
. This should work for you:
from statsmodels.discrete.discrete_model import Logit
import numpy as np
np.random.seed(42)
n, d = 20, 10
y = np.random.randint(2, size=n)
X = np.random.rand(n, d)
res = Logit(y, X).fit()
did_converge = res.mle_retvals["converged"]