Download Logistic Regression - Lecture Slides | STAT 537 and more Exams Statistics in PDF only on Docsity!
Logistic Regression
Overview
Continuous
Categorical
Linear
Regression
Analysis
Response Analysis
What Does Logistic Regression
Do?
The logistic regression model uses the
predictor variables, which can be categorical
or continuous, to predict the probability of
specific outcomes.
In other words, logistic regression is
designed to describe probabilities
associated with the values of the response
variable.
Logistic Regression
- Consider the Multiple Linear Regression Model:
y =i β 0 + β 1 xi1 + β 2 xi2 + L+ βk xik +εi
where the response variable y is dichotomous,
taking on only one of two values:
y = 1 if a success
= 0 if a failure
Logistic Regression
- When the response variable is dichotomous, a
more appropriate linear model is the
Logistic Regression Model :
⎛ ⎞ = (^) ⎜ ⎟= + + + + ⎝ − ⎠
logit( ) log (^) 1 1x 2 x 2 L k xk 1
π π α β β β π
Logistic Regression
is called the odds, and is a function of the
probability π.
What Is an Odds Ratio?
An odds ratio indicates how much more
likely, with respect to odds, a certain event
occurs in one group relative to its
occurrence in another group.
Example: How much more likely are females
to purchase 100 dollars or more
in items compared to males?
Probability of Outcome
Outcome
Group A
Group B
Total
Total
YES NO
Probability of a
in group A
Yes outcome 20/
Probability of a
in group A
NO outcome 60/
Logistic Regression
- Consider the model with one predictor
(k=1):
log x 1
⎛ ⎞ = + ⎜ ⎟ ⎝ − ⎠
( )
x x
e e e
Logit
Odds
Logistic Regression
( )
x
e e
Odds
- Every one-unit increase in x increases the
odds by a factor of e
β
Logistic Regression
e ( e )
π
x = 1
e e e e e
π
x = 2
x = 3
e e e e e e
Logistic Regression
• Thus, e
β
is the odds ratio, comparing the
odds at x+1 with the odds at x.
• An odds ratio equal to 1 (i.e., e
β
occurs when β = 0, which describes the
situation where the predictor x has no
association with the response y.
Logistic Regression
a+bx
a+bx
e
p
1+e
Example: Coronary Heart Disease
60 8 8 10 0.80 4.00000 1.
55 7 13 17 0.76 3.25000 1.
50 6 5 8 0.63 1.66667 0.
45 5 6 13 0.46 0.85714 -0.
40 4 5 15 0.33 0.50000 -0.
35 3 3 12 0.25 0.33333 -1.
30 2 2 15 0.13 0.15385 -1.
25 1 1 10 0.10 0.11111 -2.
Log(Odds) log(p/(1-p)
Odds N p p/(1-p)
CHD Present
Age Age Group
Example: Coronary Heart Disease
Multiplicative Additive
a = -2.
b = 0.
Exp(b) = Odds Ratio = 1.
60 8 8 10 0.80 4.89175 1.58755 0.
55 7 13 17 0.76 2.79947 1.02943 0.
50 6 5 8 0.63 1.60209 0.47131 0.
45 5 6 13 0.46 0.91685 -0.08681 0.
40 4 5 15 0.33 0.52470 -0.64493 0.
35 3 3 12 0.25 0.30028 -1.20305 0.
30 2 2 15 0.13 0.17184 -1.76117 0.
25 1 1 10 0.10 0.09834 -2.31929 0.
Predicted p-hat 1/(1+exp(-a-b*x))
Predicted Log(Odds) a+b*x
Predicted Odds N p exp(a+b*x)
CHD Present
Age Group Age x
Example: Coronary Heart Disease
P robability of Coronary Heart Disease
1 2 3 4 5 6 7 8 A g e Gr o up
predicted observed
log(p/(1-p)) = -2.8774 +0.5581* X
Hypothesis Testing
H 0 : β = 0
H 1 : β ≠ 0
The test statistics for testing this hypothesis
are χ
2
statistics. There are 3 that are
commonly used:
Hypothesis Testing
( )
2
QLR = −2 L α − Lα β, χ 1
( )
2
2 W 1
ˆ Q a.s.e. ˆ
⎛ ⎞ = ⎜ ⎟ ⎜ ⎟ ⎝ ⎠