Logistic and Nonlinear Regression: Department of Political Science AND International Relations Posc/Uapp 816
Logistic and Nonlinear Regression: Department of Political Science AND International Relations Posc/Uapp 816
AND
INTERNATIONAL RELATIONS
Posc/Uapp 816
I. AGENDA:
A. Some remarks about time series analysis
B. Logistic regression
C. Non-linear (polynomial) regression
D. Reading: Agresti and Finlay Statistical Methods in the Social Sciences, 3rd
edition, pages 576 to 585.
i. The probability the variable, Y, takes the value j (e.g., 0) given that
X’s equal certain values is a function of these independent or
explanatory factors.
ii. This model could and perhaps should be written more simply as
B(Y) ' f(X)
V. LOGISTIC MODEL:
A. Again let π be the probability that Y = 1.
B. A model for π that addresses the concerns listed above is to use the “log odds,”
also called the logit:
B
S ' f(X) ' log ' $0 % $1 X
1 & B
Posc/Uapp 816 Class 22 Logistic and Nonlinear Regression Page 4
through β1
5. Defined this way, this model has the property that estimated or predicted
logits can lie anywhere on the number line from minus to plus infinity,
while odds will lie between 0 and infinity..
D. To see better the meaning of the terms consider a very simple example and some
data:
B
log ' 1 % 1X
1 & B
i. For negative values of X, the log odds can decrease without end,
but the odds converge to 0.
ii. At the other end of the scale, as X becomes increasingly large, the
log odds and plain odds increase without limit.
1) Briefly, the log odds, - 4 Ω < 4, whereas 0 # Ο < 4
3. We see that X has a linear or additive effect on the log odds: as X
increases one unit, the logit increases one unit.
4. For the plain odds, however, β1 = 1 (as in this example) indicates that X
has a multiplicative impact, which depends on the value of X.
i. The antilog of β1 is 2.718.
ii. When X increases by one unit, the odds will multiply by 2.718.
1) As X increases from 0 to 1 (a one unit change), the odds
increase from 2.718 to (2.718 X 2.718) = 7.389; another
one unit increase in X changes the odds to 2.718 X 7.389 =
20.09; still another one unit change in X gives odds of 2.718
X 20.09 = 54.60.
E. We can use algebra to find the expression for the probability, π or simple odds of a
Posc/Uapp 816 Class 22 Logistic and Nonlinear Regression Page 6
“success”:
e $0 % $1X
B '
1 % e $0 % $1X
0 for yes.
4. Wages = 1 for yes vote to increase minimum wage, 0 for no vote.
i. These are just dummy variables that are now treated as dependent
or responses.
ii. In the first case, the reference category is the vote to repeal the ban
(“yes”) where as in the second the reference category is no.
5. Party affiliation: 1 for Democrat and 0 for Republican.
i. Another dummy variable that is used as an independent or
explanatory factor.
6. We won’t use all of these today.
D. Let’s start with the amendment to lift the ban on assault weapons.
1. Suppose we hypothesize that votes on this issue are determined by
population density, the variable we called “rural.”
2. Let π = the probability that Y = 1, that is, a “no” vote.
3. A model for the log odds of a vote to keep the ban is
B
S ' log ' $0 % $1Rural % g
1 & B
B $0 % $1Rural
? ' ' e % g
1 & B
5. And a the model for the probability of a vote against the repeal (Y = 1) is
e $0 % $1Rural
B ' % g
1 % e $0 % $1Rural
E. We can use MINITAB (or any program that has logistic regression) to estimate
the parameters and assess the goodness of fit of the data to the model, just as with
simple regression.
1. SPSS has logistic regression as part of an “add on” module.
2. Here are the results of the California representatives data.
i. I used MINITAB’s binary logistic regression procedure.
Posc/Uapp 816 Class 22 Logistic and Nonlinear Regression Page 8
Response Information
Log-Likelihood = -18.856
Test that all slopes are zero: G = 7.321, DF = 1, P-Value = 0.007
3. We see that 26 representatives voted “no” (that is, voted against the repeal
effort) and 11 voted yes.
i. There are 9 missing cases, representatives who didn’t vote or were
new to Congress or whatever.
ii. I also omitted some for whom data were not available on short
notice.
iii. Hence the effective N = 37.
4. The estimated equation is:
B
S
Ŝ ' log ' 1.6668 & .08944Rural
1 & B
ii. Hence, the odds of a no vote are multiplied (that is, decreased) by
.91444 for each one percent increase in rural population in the
district.
1) Note by the way, that this value appears in the MINITAB
results under the “odds ratio” column.
4. If eβ1 is less than 1.0, the odds will be reduced for a unit increase in X; if eβ1
is greater than 1.0, the odds will be increased. If it equals = 1, then X does
not affect the odds.
i. Hence we will later be testing the hypothesis that β1 = 0 in order to
see if eβ1 is close to 1.
5. Example: if the odds of voting no are 5.295, as above, a one percent
increase in rural population will decrease them to .91444 X 5.295 =
4.8422.
i. A 10 percent increase in rural population in the district would
decrease the odds to (.91444)10 X 5.2952 = 2.16496.
1) Remember: .91444 represents the estimated coefficient
-.08944 to e. That is, e &.08944(10) ' .9144410
ii. Or we could compare the odds of voting “no” in districts with 0
and 100 percent rural inhabitants:
1) For 0 percent rural (i.e., urban) districts: estimated odds =
5.2952 to 1, as above.
2) For 100 percent rural: estimated odds = .00069 to 1.
iii. By using your calculator or the mathematical expressions (or
calculator) functions in MINITAB, you can explore other
possibilities.
6. For example, if you look at the estimated odds when X = 5, say, and when
X = 6, you can take the ratio of these odds to find the antilog of the
estimated regression coefficient.
i. Estimated log odds for X = 5 is
S
ŜX''5 ' 1.6669 & .08944(5) ' 1.2171
and
?
ˆ
'5 ' e
X'
1.2171
' 3.37778
Posc/Uapp 816 Class 22 Logistic and Nonlinear Regression Page 10
S
ŜX''6 ' 1.6669 & .08944(6) '1.13016
and
?
ˆ
'6 ' e
X'
1.13016
' 3.09615
Log-Likelihood = -5.610
Test that all slopes are zero: G = 33.814, DF = 1, P-Value = 0.000
.
i. The estimated equation for the logit is:
S
Ŝ ' &2.945 % .15339ADA
ii. And the antilog of the regression parameter, which is the odds
ratio, is e.15339 = 1.16578.
iii. As we’ve seen, a one unit increase in X is associated with .15339
increase in the log odds and a multiplicative increase in the odds or
1.16578.
iv. To grasp the substantive meaning of the numbers it is sometimes
helpful to obtain estimated odds for various meaningful values of X.
1) Suppose, for example, X = 0. Then, the estimated log odds
are: -2.945 + .15339(0) = -2.945. Taking the antilog, we
see that the odds of a “no vote” to a “yes vote” for extreme
conservatives (ADA = ) is e-2.945 = .0526 to 1.
2) That is, there is virtually no chance a strong conservative
will vote against the repeal. To see this even more clearly,
get the estimated probability of voting “no” from the
Posc/Uapp 816 Class 22 Logistic and Nonlinear Regression Page 11
vi. It’s only with the very conservative members, say ADA = 10, that
the probability of a no vote declines. (By the way, what are the
estimated log odds, odds, and probability of a no vote for ADA =
10?)
Posc/Uapp 816 Class 22 Logistic and Nonlinear Regression Page 12
Log-Likelihood = -5.582
Test that all slopes are zero: G = 33.869, DF = 2, P-Value = 0.000
D. We need to wait a minute before deciding whether or not using two predictors
helps.
1. But you might anticipate on what has gone before that there really won’t
be an improvement.
i. For one thing, there is a relatively strong negative correlation
between ADA and percent rural, -.461.
2. The estimated equation for the log odds is:
S
Ŝ ' &2.711 & .01497Rural % .14762ADA
3. To see what the numbers mean just substitute some meaningful values for
X1 and X2 such as 0 and 0.
i. Actually this combination would not make sense in American
politics because it’s unlikely that an extreme conservative (ADA =
0) would represent a totally urbanized district (rural = 0).
ii. Anyway, the estimated log odds would be -2.711 and the estimated
odds would be e-2.711 = .0665 to 1.
iii. What would the log odds, odds and predicted probability be for a
representative from a district with a rural population of 30 and an
ADA score of 70?
Posc/Uapp 816 Class 22 Logistic and Nonlinear Regression Page 13
i. No
te that the X values associated with Y = 0 are all smaller than those
associated with Y = 1. In this situation, a program might produce
results but will usually flash a warning such as
ii. If this case arises try collecting more cases so that there is some
separation in the data.
1
Thomas P. Ryan, Modern Regression Methods (Wiley, 1997) page 263.
Posc/Uapp 816 Class 22 Logistic and Nonlinear Regression Page 14
Number Number
Y=0 correct incorrect
Number Number
Y=1 incorrect correct
X. NEXT TIME:
A. More on inference for logistic regression
Go to Notes page
Go to Statistics page