Logistic Regression - Example
Logistic Regression - Example
Example
Consider ‘cars_data’ (R dataset: mtcars), where the Drive Type of Car {am:
a=automatic=0 & m=manual=1} is regressed on (say) Car Mileage {mpg}. Here,
the Dependent variable {am} is a Categorical variable having values {0,1}
and therefore not Normally distributed; whereas the Independent variable
{mpg} is a Continuous Numeric variable.
A N Mitra, 2022.
1
Logistic Regression
Deviance Residuals:
Min 1Q Median 3Q Max
-1.5701 -0.7531 -0.4245 0.5866 2.0617
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -6.6035 2.3514 -2.808 0.00498 **
mpg 0.3070 0.1148 2.673 0.00751 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
mpg 15 16 17 18 19 20 21 22 23 24 25
p(am=1) 0.11 0.14 0.18 0.23 0.29 0.35 0.43 0.50 0.57 0.65 0.71
odds 0.12 0.16 0.22 0.30 0.41 0.54 0.75 1.00 1.33 1.86 2.45
odds_ratio 1.00 1.33 1.83 2.50 3.42 4.50 6.25 8.33 11.08 15.50 20.42
or_%_inc 0:0 1:33 2:83 3:150 4:242 5:350 6:525 7:733 8:1008 9:1450 10:1942
A N Mitra, 2022.
2
Logistic Regression
Inferences
1. Probability that a Car has Manual Drive Type [p(am=1)] increases with
the increase in Mileage (mpg).
2. Cars with [mpg<22] have low Probability (p<0.5) of having Manual Drive
Type. Cars with [mpg>22] have high Probability (p>0.5) of having
Manual Drive Type.
3. At mpg=22, p(am=1)=0.5 and odds=1 (that is Odds are Even); implies
that, at mpg=22, the Probability of a Car having Automatic or Manual
Drive Type is equal.
4. An 1 unit increase in {mpg} increases the Odds (not Probability) of
Car being Manual (am=1) by 33%.
A N Mitra, 2022.
3