[This article was first published on Yet Another Blog in Statistical Computing » S+/R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. In [1]: import pandas as pd In [2]: import statsmodels.api as sm In [3]: data = pd.read_table('/home/liuwensui/Documents/data/csdata.txt') In [4]: Y = data.LEV_LT3 In [5]: X = sm.add_constant(data[['COLLAT1', 'SIZE1', 'PROF2', 'LIQ', 'IND3A']]) In [6]: # Discrete Dependent Variable Models with Logit Link In [7]: mod = sm.Logit(Y, X) In [8]: res = mod.fit() Optimization terminated successfully. Current function value: 882.448249 Iterations 8 In [9]: print res.summary() Logit Regression Results ============================================================================== Dep. Variable: LEV_LT3 No. Observations: 4421 Model: Logit Df Residuals: 4415 Method: MLE Df Model: 5 Date: Sun, 16 Dec 2012 Pseudo R-squ.: 0.04022 Time: 23:40:40 Log-Likelihood: -882.45 converged: True LL-Null: -919.42 LLR p-value: 1.539e-14 ============================================================================== coef std err z P>|z| [95.0% Conf. Int.] ------------------------------------------------------------------------------ COLLAT1 1.2371 0.260 4.756 0.000 0.727 1.747 SIZE1 0.3590 0.037 9.584 0.000 0.286 0.432 PROF2 -3.1431 0.739 -4.254 0.000 -4.591 -1.695 LIQ -1.3825 0.357 -3.867 0.000 -2.083 -0.682 IND3A 0.5466 0.141 3.867 0.000 0.270 0.824 const -7.2498 [...]
[Read more...]