Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

statsmodels logistic regression odds ratio

>>> import statsmodels.api as sm
>>> import numpy as np
>>> X = np.random.normal(0, 1, (100, 3))
>>> y = np.random.choice([0, 1], 100)
>>> res = sm.Logit(y, X).fit()
Optimization terminated successfully.
         Current function value: 0.683158
         Iterations 4
>>> res.summary()
<class 'statsmodels.iolib.summary.Summary'>
"""
                           Logit Regression Results                           
==============================================================================
Dep. Variable:                      y   No. Observations:                  100
Model:                          Logit   Df Residuals:                       97
Method:                           MLE   Df Model:                            2
Date:                Sun, 05 Jun 2016   Pseudo R-squ.:                0.009835
Time:                        23:25:06   Log-Likelihood:                -68.316
converged:                       True   LL-Null:                       -68.994
                                        LLR p-value:                    0.5073
==============================================================================
                 coef    std err          z      P>|z|      [95.0% Conf. Int.]
------------------------------------------------------------------------------
x1            -0.0033      0.181     -0.018      0.985        -0.359     0.352
x2             0.0565      0.213      0.265      0.791        -0.362     0.475
x3             0.2985      0.216      1.380      0.168        -0.125     0.723
==============================================================================
"""
>>>
Comment

PREVIOUS NEXT
Code Example
Python :: break outside loop python 
Python :: convert html to python 
Python :: ValueError: Could not load "" Reason: "broken data stream when reading image file" 
Python :: qcut and cut function in python stack overflow 
Python :: django.db.utils.IntegrityError: column contains null values 
Python :: reload module 
Python :: pyqt5 how to check if a push button is triggered 
Python :: Slice Age in Python 
Python :: ffff in decimal python 
Python :: count each value in lsitp ython 
Python :: Arduino - Send Commands with Serial Communication with python 
Python :: comprehensive python cheat sheet 
Python :: pvector python processing 
Python :: pandas turn counts into probability 
Python :: how to resume request downloads 
Python :: wexpect in python 
Python :: python numpy 
Python :: python code to open an application 
Python :: swap variables 
Python :: python sleep 10 seconds 
Python :: how to make dice roll in python 
Python :: break continue pass in python 
Python :: mysql_python 
Python :: add element to list python 
Python :: TypeError: expected str, bytes or os.PathLike object, not list 
Python :: sum 2d array in python 
Python :: text to speech program in python 
Python :: convert int to hexadecimal 
Python :: positive and negative number in python 
Python :: sum of diagonal numpy 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =