Logistics Regression
Logistics Regression
Logistics Regression
[17]: y x1 x2 x3 x4 age
0 1 0 1 1 1 4.67
1 1 0 1 1 1 5.67
2 1 0 1 0 1 6.00
3 1 0 1 1 1 7.08
4 1 0 1 1 1 8.00
.. .. .. .. .. .. …
90 2 0 2 0 2 6.25
91 2 0 2 1 2 7.50
92 2 0 2 1 2 8.50
93 2 0 2 0 2 9.67
94 1 0 1 1 2 10.17
[41]: x=lgit[['y','x2','x1','x4','age']]
Y=lgit['x3']
[19]: plt.scatter(lgit.age,lgit.y,marker='+',color='b')
1
1 Logistics Regression (Binary logistics Reg ’y always 0 and 1 form
response)
[44]: sns.countplot(x='x4',data=lgit)
2
[47]: sns.countplot(x='x3',data=lgit)
3
[48]: lgit['age'].plot.hist()
[48]: <AxesSubplot:ylabel='Frequency'>
[42]: lgitm=sm.Logit(Y,x)
result=lgitm.fit()
print(result.summary2())
4
x2 -0.1829 0.5830 -0.3137 0.7538 -1.3256 0.9598
x1 -1.3874 0.7530 -1.8424 0.0654 -2.8633 0.0886
x4 0.5163 0.5915 0.8729 0.3827 -0.6430 1.6755
age 0.1106 0.0644 1.7187 0.0857 -0.0155 0.2367
===============================================================
[ ]: