Lec 6
Lec 6
Brandon Stewart1
Princeton
1
These slides are heavily influenced by Matt Blackwell, Adam Glynn and Jens
Hainmueller.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 1 / 132
Where We’ve Been and Where We’re Going...
Last Week
I mechanics of OLS with one variable
I properties of OLS
This Week
I Monday:
F adding a second variable
F new mechanics
I Wednesday:
F omitted variable bias
F multicollinearity
F interactions
Next Week
I multiple regression
Long Run
I probability → inference → regression
Questions?
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 2 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 3 / 132
Why Do We Want More Than One Predictor?
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 4 / 132
Example 1: Cigarette Smokers and Pipe Smokers
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 5 / 132
Example 1: Cigarette Smokers and Pipe Smokers
Consider the following example from Cochran (1968). We have a random sample
of 20,000 smokers and run a regression using:
Y : Deaths per 1,000 Person-Years.
X1 : 0 if person is pipe smoker; 1 if person is cigarette smoker
Death
\ Rate = 17 − 4 Cigarette Smoker
What do we conclude?
The average death rate is 17 deaths per 1, 000 person-years for pipe smokers
and 13 (17 - 4) for cigarette smokers.
So cigarette smoking lowers the death rate by 4 deaths per 1,000 person
years.
Death
\ Rate = 14 + 4 Cigarette Smoker + 10 Age
Why did the sign switch? Which estimate is more useful?
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 6 / 132
Example 2: Berkeley Graduate Admissions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 7 / 132
Berkeley gender bias?
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 8 / 132
Berkeley gender bias?
Within departments:
Men Women
Dept Applied Admitted Applied Admitted
A 825 62% 108 82%
B 560 63% 25 68%
C 325 37% 593 34%
D 417 33% 375 35%
E 191 28% 393 24%
F 373 6% 341 7%
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 9 / 132
Simpson’s paradox
1
Z=1
0
Y
-1
Z=0
-2
-3
0 1 2 3 4
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 11 / 132
Basic idea
Yi = β0 + β1 Xi + β2 Zi + ui
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 12 / 132
Why control for another variable
Descriptive
I get a sense for the relationships in the data.
I describe more precisely our quantity of interest
Predictive
I We can usually make better predictions about the dependent variable
with more information on independent variables.
Causal
I Block potential confounding, which is when X doesn’t cause Y , but
only appears to because a third variable Z causally affects both of
them.
I Xi : ice cream sales on day i
I Yi : drowning deaths on day i
I Zi : ??
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 13 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 14 / 132
Regression with Two Explanatory Variables
Example: data from Fish (2002) “Islam and Authoritarianism.” World
Politics. 55: 4-37. Data from 157 countries.
Variables of interest:
I Y : Level of democracy, measured as the 10-year average of Freedom
House ratings
I X1 : Country income, measured as log(GDP per capita in $1000s)
I X2 : Ethnic heterogeneity (continuous) or British colonial heritage
(binary)
With one predictor we ask: Does income (X1 ) predict or explain the
level of democracy (Y )?
With two predictors we ask questions like: Does income (X1 ) predict
or explain the level of democracy (Y ), once we “control” for ethnic
heterogeneity or British colonial heritage (X2 )?
7
We have looked at the
●
● ●
● ● ● ● ●● ●
●● ●
●
●
● ●
regression of Democracy on
● ●● ●
6
● ●
●
● ● ● ●● ● ●
● ●●
● ●
● ●
ybi = βb0 + βb1 x1 ●
5
● ● ●
● ●
● ● ●●
●
Democracy
●● ●
● ●
●
course:
● ● ●
● ● ● ●●●
●
4
● ● ●
● ●
● ● ● ●
●
●
●
●
● ●
●
●
3
●
● ●
● ● ●
● ●● ● ● ● ●
●● ●
2
● ●● ●
● ●
● ●
●
●● ●
●●●
●
●
● ● ● ●● ●●
1
2.0 2.5 3.0 3.5 4.0 4.5
Income
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 16 / 132
Simple Regression of Democracy on Income
We may want to use more
information in our prediction
But we can use more information in ●
●● ●
●●
● ●
●●
● ●
●●
●
●●
●●●● ●
7
● ●
●● ● ●
equation.
●
●
●
● ●
●
●
● ●● ●
● ●
● ●
●●●
●
●
●
●●
●
●
our prediction equation. ●
●
●
●●
●
●
●
●
●
●
●
●
6
● ●● ●
●
● ●
●
●
●
●
● ●
● ●
●
were originally
someBritish colonies
●
5
●
●
● ●
●
●
●
●
● ●
●
●
● ●
● ●
●●●
●
Democracy
●
4
●
●
● ●
● ●
●
●● ●
●
●
●
●
● ●
●
●
●
●
● ●
●
●
●
●
●
●
●● ●
● ●
●
3
not:
● ●
●
●
●
● ●
●
●
● ●
● ●
●
●●
● ●
●
● ●
●
●
● ●●
●● ●●
● ● ●
●
●
●
●
●
● ● ● ● ●
●
tend to be higher
● ● ● ●
●
●
●
●
●
●
2
●
● ●
●●
●
●
●
●
● ●
●
●
●
1
●● ● ● ● ●
lower
I Non-colony countries tend to Income
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 17 / 132
Adding a Covariate
This implies that we want to predict y using the information we have about x1
and x2 , and we are assuming a linear functional form.
In words:
\ = βb0 + βb1 Log (GDP) + βb2 Colony
Democracy
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 18 / 132
Interpreting a Binary Covariate
What does this mean? We are fitting two lines with the same slope but
different intercepts.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 19 / 132
Linear Regression with Interaction terms
Inference for Slopes
Regression of Democracy
What does on Income
this mean?
From R, we obtain estimates
βb1 , βb2 :R, we obtain estimates
βb0 , Using
for β̂0 , β̂1 , and β̂2
Coefficients:
Estimate
lm(Democracy ~ Income + BritishColony)
(Intercept) -1.5060
Coefficients:
GDP90LGN
(Intercept)1.7059
7
●● ●● ●● ●●
●●●●● ●
Income BritishColony ● ●
●
6
● ●● ●
● ●
●
● ● ● ● ● ● ●
●
● ●
● ● ●
● ● ●
Non-British colonies:
5
● ● ●
●
● ●
● ●
Non-British colonies:
●●
Democracy
●
●● ●
● ●
● ● ●
● ● ●
● ●● ●
4
● ● ●
● ● ●
● ● ●
● ●
● ●
ŷi yb==−1.527
βb0 + βb1 x+ 1.711xi
● ●
1 ● ●●
●
● ● ● ●
3
● ●
●
● ●
● ● ●
● ●● ●
yb = −1.5 + 1.7 x1
● ● ●
●● ●
● ●
● ● ● ● ●
● ●
●
2
● ●● ●
British colonies:
● ●
● ●
●
●● ●
●● ●● ●
●●
1
● ● ● ●●
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 20 / 132
What does
Regression this mean?
of Democracy on Income
Our prediction equation is
Ourŷprediction
i = −1.527 + 1.711x
equation is:i + 0.592zi
yb = −1.5 + 1.7 x1 + .58 x2
Where do these quantities
appear
Where on the
do these graph? appear on
quantities
6
the graph?β̂0 = −1.527 is the
4
βb0 =intercept
−1.5 is thefor the prediction
intercept for the
Democracy
line for non-British colonies.
prediction line for non-British
2
colonies.
0
βb1 = 1.7 is the slope for both lines.
β̂1 = 1.711 is the slope for ^
β2
−2
between the two lines for Ex-British 0 1 2 3 4 5
β̂2 =
colonies and0.592 is the respectively
non-colonies vertical Income
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 21 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 22 / 132
Linear Regression with Interaction terms
Inference for Slopes
Fitting a regression
Fitting planeplane
a regression
We have considered an
example of multiple regression
7
●● ●● ●● ●●
●●●●● ●
6
● ●● ●
● ●
explanatory variablevariable
and one
●
● ● ● ● ● ● ●
●
● ●
5
● ● ●
binary explanatory
explanatory variable.
●
● ●
● ●
Democracy
●
●● ●
● ●
● ● ●
● ● ●
● ●● ●
4
● ● ●
● ● ●
● ● ●
● ●
● ●● ● ● ● ●
●
3
● ●
graphically in because
two dimensions
● ● ●
● ●● ● ● ● ●
●● ●
● ●
● ● ● ● ●
2
● ●● ●
●●
1
● ● ● ●●
distinguish
the data. the two groups in 2.0 2.5 3.0 3.5 4.0 4.5
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 23 / 132
Regression of Democracy on Income
● ● ●● ●
●
●
●
These observations are actually ● ●
located in a three-dimensional ●
●
space. ● ●
●
● ● ●
●
●●
●●● ●
7
●
●
●
●●● ● ● ●●● ●
●● ●
We can try to represent this ● ● ● ●● ● ●
●
● ●
6
● ● ●
● ●●● ●
●● ●● ● ●
using a 3D scatterplot. ●
●
● ●● ●
●
●
●●
5
●
● ● ● ● ●●
Democracy
● ●
● ● ● ●●
●●● ● ●
4
● ●
● ●●
the data from the Income side; ●
●
● ●
●
●
●
●
●
● 1.0
3
●
the two regression lines are ●● ● ●●
●
●
●● ● ●
●
●
● 0.8
● ● ● ● ●
drawn in the appropriate ●
2
● ●● ● 0.6
● ●
● ● ●
locations. ●● ●
● ●●
● ●
●
●● ●●
0.4
1
0.2
0.0
0
Income
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 24 / 132
Regression of Democracy on Income
colony side. ●
● ●●
●
●
●
●
●
●
●
●●
●● ● ●
7
●●
status variable is either 0 or 1, ●
●
●
● ●● ●● ●●
● ● ●
●
●
● ●
6
there is nothing in the ●
●● ●●
● ●
●
●●●
●
● ●
●●
●
● ● ●
prediction equation that ● ●●
5
● ●
●● ● ●● ●
● ● ●
Democracy
● ●
requires this to be the case. ●● ●
●
● ●
● ●
4
● ●●● ●
● ● ● ● 5.0
● ● ● ●
●● ●
● ●● ● ● 4.5
In fact, the prediction equation ●
3
●
● ● ●
● ● ● ●
●
● ● 4.0
●
defines a regression plane that ● ●
●
2
● ●● 3.5
●
●
●●
connects the lines when x2 = 0 ● ●
3.0
1
2.5
and x2 = 1. 2.0
0
Colony
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 25 / 132
Regression with two continuous variables
Democracy
\ = β̂0 + β̂1 Income + β̂2 Ethnic Heterogeneity
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 26 / 132
tting a regression plane
Regression of Democracy on Income
● ● ●●
●
● ●
●●
●
●
●
●●
7
●● ● ● ●
●
● ● ● ●
● ● ● ● ●●
● ●
● ●
● ●
● ●
● ● ●
6
● ●● ●
● ● ●
● ●
b1 = 1.6 for Income
I β
β̂0 = −0.717 ●
●
●
●
●
●
●
●● ●
●
●
●
●
●
●
●
●
5
●
●●
Democracy
● ● ●
β̂1 = 1.573
● ●
● ●● ●●
●●●
EthnicHeterogeneity
● ● ● ●
4
● ●● ●
Heterogeneity
● ●● ●
●
●
● ●
● ● ●
●
●
3
●
●● ●
−0.550
β̂2 =How
● ●
● ●
●● ● 1.0
does this look ●
●
●
●
●
●
0.6
0.8
2
● ●
●
graphically? ●
●
● 0.2
0.4
0.0
∂(y = β0 + β1 X1 + β2 X2 )
= β1
∂X1
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 28 / 132
What does this
Interpreting mean? Covariate
a Continuous
7
the relationship between
Democracy and and Income
Incomeat
6
Democracy at
every level
everyof Ethnic
level of Ethnic
5
Heterogeneity.
Democracy
Heterogeneity.
4
All of these lines are parallel
All of these
since lines aretheparallel
3
they have slope
since they
βb1 =have
1.6 the slope β̂ .
1
Ethnic Heterogeneity = 0
2
Ethnic Heterogeneity = 0.25
Ethnic Heterogeneity = 0.5
The lines shift up or down Ethnic Heterogeneity = 0.75
Heterogeneity.
Stewart (Princeton)
Gov2000: Quantitative Methodology
Week 6: Two Regressors
for Political Science
October 17, 19, 2016
I
29 / 132
More Complex Predictions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 30 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 31 / 132
AJR Example
11
Non-African countries
10
9
Log GDP per capita
8
7
African countries
6
5
4
0 2 4 6 8 10
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 32 / 132
Basics
Ye olde model:
Ybi = βb0 + βb1 Xi
Zi = 1 to indicate that i is an African country
Zi = 0 to indicate that i is an non-African country
Concern: AJR might be picking up an “African effect”:
I African countries have low incomes and weak property rights
I “Control for” country being in Africa or not to remove this
I Effects are now within Africa or within non-Africa, not between
New model:
Ybi = βb0 + βb1 Xi + βb2 Zi
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 33 / 132
AJR model
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.65556 0.31344 18.043 < 2e-16 ***
## avexpr 0.42416 0.03971 10.681 < 2e-16 ***
## africa -0.87844 0.14707 -5.973 3.03e-08 ***
## ---
## Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
##
## Residual standard error: 0.6253 on 108 degrees of freedom
## (52 observations deleted due to missingness)
## Multiple R-squared: 0.7078, Adjusted R-squared: 0.7024
## F-statistic: 130.8 on 2 and 108 DF, p-value: < 2.2e-16
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 34 / 132
Two lines in one regression
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 35 / 132
Example interpretation of the coefficients
Let’s review what we’ve seen so far:
Intercept for Xi Slope for Xi
Non-African country (Zi = 0) βb0 βb1
African country (Zi = 1) βb0 + βb2 βb1
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 37 / 132
Adding a binary variable, visually
11
β0 = 5.656
β1 = 0.424
10
9
β2 = -0.878
Log GDP per capita
8
7
β2
6
β0
5
β0 + β 2
4
0 2 4 6 8 10
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 38 / 132
Adding a continuous variable
Ye olde model:
Ybi = βb0 + βb1 Xi
Zi : mean temperature in country i (continuous)
Concern: geography is confounding the effect
I geography might affect political institutions
I geography might affect average incomes (through diseases like malaria)
New model:
Ybi = βb0 + βb1 Xi + βb2 Zi
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 39 / 132
AJR model, revisited
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.80627 0.75184 9.053 1.27e-12 ***
## avexpr 0.40568 0.06397 6.342 3.94e-08 ***
## meantemp -0.06025 0.01940 -3.105 0.00296 **
## ---
## Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
##
## Residual standard error: 0.6435 on 57 degrees of freedom
## (103 observations deleted due to missingness)
## Multiple R-squared: 0.6155, Adjusted R-squared: 0.602
## F-statistic: 45.62 on 2 and 57 DF, p-value: 1.481e-12
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 40 / 132
Interpretation with a continuous Z
Intercept for Xi Slope for Xi
Zi = 0 ◦C βb0 βb1
Zi = 21 ◦ C βb0 + βb2 × 21 βb1
Zi = 24 ◦ C βb0 + βb2 × 24 βb1
Zi = 26 ◦ C βb0 + βb2 × 26 βb1
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 42 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 43 / 132
Fitted values and residuals
Residuals for i = 1, . . . , n:
ubi = Yi − Ybi
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 44 / 132
Least squares is still least squares
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 45 / 132
OLS estimator recipe using two steps
“Partialling out” OLS recipe:
1 Run regression of Xi on Zi :
rbxz,i = Xi − Xbi
3 Run a simple regression of Yi on residuals, rbxz,i :
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 46 / 132
Regression property rights on mean temperature
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.95678 0.82015 12.140 < 2e-16 ***
## meantemp -0.14900 0.03469 -4.295 6.73e-05 ***
## ---
## Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
##
## Residual standard error: 1.321 on 58 degrees of freedom
## (103 observations deleted due to missingness)
## Multiple R-squared: 0.2413, Adjusted R-squared: 0.2282
## F-statistic: 18.45 on 1 and 58 DF, p-value: 6.733e-05
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 47 / 132
Regression of log income on the residuals
## (Intercept) avexpr.res
## 8.0542783 0.4056757
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 48 / 132
Residual/partial regression plot
Useful for plotting the conditional relationship between property rights and
income given temperature:
10
Log GDP per capita
6
-3 -2 -1 0 1 2 3
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 49 / 132
Deriving the Linear Least Squares Estimator
(The same works more generally for k regressors, but this is done
more easily with matrices as we will see next week)
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 50 / 132
Deriving the Linear Least Squares Estimator
We want to minimize the following quantitity with respect to (β̃0 , β̃1 , β̃2 ):
n
X
S(β̃0 , β̃1 , β̃2 ) = (yi − β̃0 − β̃1 xi − β̃2 zi )2
i=1
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 51 / 132
First Order Conditions
Setting the partial derivatives equal to zero leads to a system of 3 linear equations
in 3 unknowns: β̂0 , β̂1 and β̂2
n
∂S X
= (yi − β̂0 − β̂1 xi − β̂2 zi ) = 0
∂ β̃0 i=1
n
∂S X
= xi (yi − β̂0 − β̂1 xi − β̂2 zi ) = 0
∂ β̃1 i=1
n
∂S X
= zi (yi − β̂0 − β̂1 xi − β̂2 zi ) = 0
∂ β̃2 i=1
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 53 / 132
“Partialling Out” Interpretation of the OLS Estimator
Assume Y = β0 + β1 X + β2 Z + u. Another way to write the OLS estimator is:
Pn
rˆxz,i yi
β̂1 = Pi n 2
i rˆxz,i
X = λ + δZ + rxz
1 Linearity
Yi = β0 + β1 Xi + β2 Zi + ui
2 Random/iid sample
3 No perfect collinearity
4 Zero conditional mean error
E[ui |Xi , Zi ] = 0
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 56 / 132
New assumption
Two components
1 Both Xi and Zi have to vary.
2 Zi cannot be a deterministic, linear function of Xi .
Part 2 rules out anything of the form:
Zi = a + bXi
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 57 / 132
Perfect collinearity example (I)
Simple example:
I Xi = 1 if a country is not in Africa and 0 otherwise.
I Zi = 1 if a country is in Africa and 0 otherwise.
But, clearly we have the following:
Zi = 1 − Xi
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 58 / 132
R and perfect collinearity
R, and all other packages, will drop one of the variables if there is
perfect collinearity:
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.71638 0.08991 96.941 < 2e-16 ***
## africa -1.36119 0.16306 -8.348 4.87e-14 ***
## nonafrica NA NA NA NA
## ---
## Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
##
## Residual standard error: 0.9125 on 146 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.3231, Adjusted R-squared: 0.3184
## F-statistic: 69.68 on 1 and 146 DF, p-value: 4.87e-14
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 59 / 132
Perfect collinearity example (II)
Another example:
I Xi = mean temperature in Celsius
I Zi = 1.8Xi + 32 (mean temperature in Fahrenheit)
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 60 / 132
OLS assumptions for large-sample inference
E[ui |Xi , Zi ] = 0
5 Homoskedasticity
var[ui |Xi , Zi ] = σu2
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 61 / 132
Inference with two independent variables in large samples
βb1 − β1
∼ N(0, 1)
c [βb1 ]
SE
βb2 − β2
∼ N(0, 1)
c [βb2 ]
SE
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 62 / 132
OLS assumptions for small-sample inference
For small-sample inference, we need the Gauss-Markov plus Normal errors:
1 Linearity
Yi = β0 + β1 Xi + β2 Zi + ui
2 Random/iid sample
3 No perfect collinearity
4 Zero conditional mean error
E[ui |Xi , Zi ] = 0
5 Homoskedasticity
var[ui |Xi , Zi ] = σu2
ui ∼ N(0, σu2 )
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 63 / 132
Inference with two independent variables in small samples
Under assumptions 1-6, we have the following small change to our
small-n sampling distribution:
βb1 − β1
∼ tn−3
c [βb1 ]
SE
βb2 − β2
∼ tn−3
c [βb2 ]
SE
Why n − 3?
I We’ve estimated another parameter, so we need to take off another
degree of freedom.
small adjustments to the critical values and the t-values for our
hypothesis tests and confidence intervals.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 64 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 65 / 132
Red State Blue State
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 66 / 132
Red and Blue States
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 67 / 132
Rich States are More Democratic
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 68 / 132
But Rich People are More Republican
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 69 / 132
Paradox Resolved
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 70 / 132
If Only Rich People Voted, it Would Be a Landslide
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 71 / 132
A Possible Explanation
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 72 / 132
References
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 73 / 132
Where We’ve Been and Where We’re Going...
Last Week
I mechanics of OLS with one variable
I properties of OLS
This Week
I Monday:
F adding a second variable
F new mechanics
I Wednesday:
F omitted variable bias
F multicollinearity
F interactions
Next Week
I multiple regression
Long Run
I probability → inference → regression
Questions?
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 74 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 75 / 132
Remember This?
@(A--B?(.C)D*EF<3GH* 5:(--/'(:*<?*EF3GH*
!"#$%&'(%)$* 3$4/(-#"$#--*
I-680,)%'*!$J#.#$'#************* 98(::B9(80:#*!$J#.#$'#***
+(,(*+#-'./0%)$* 5)$-/-,#$'6* EK*($"*!LH" E,*($"*NH*
M)8)-C#"(-%'/,6* M)8)-C#"(-%'/,6*
O).8(:/,6*)J*G..).-*
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 76 / 132
Unbiasedness revisited
True model:
Yi = β0 + β1 Xi + β2 Zi + ui
Assumptions 1-4 ⇒ we get unbiased estimates of the coefficients
What happens if we ignore the Zi and just run the simple linear
regression with just Xi ?
Misspecified model:
Yi = β0 + β1 Xi + ui∗ ui∗ = β2 Zi + ui
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 77 / 132
Omitted Variable Bias: Simple Case
True Population Model:
Y = β0 + β1 X1 + β2 X2 + u
ỹ = β̃0 + β̃1 x1
We can show that the relationship between β̃1 and β̂1 is:
where:
δ̃ is the slope of a regression of x2 on x1 . If δ̃ > 0 then cor(x1 , x2 ) > 0 and if
δ̃ < 0 then cor(x1 , x2 ) < 0.
β̂2 is from the true regression and measures the relationship between x2 and
y , conditional on x1 .
Q. When will β̃1 = β̂1 ?
A. If δ̃ = 0 or β̂2 = 0.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 80 / 132
Omitted Variable Bias: Simple Case
We take expectations to see what the bias will be:
So
Bias[β̃1 | X ] = E [β̃1 | X ] − β1 = β2 · δ̃
So the bias depends on the relationship between x2 and x1 , our δ̃, and the
relationship between x2 and y , our β2 .
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 81 / 132
Omitted Variable Bias: Simple Case
Further points:
Magnitude of the bias matters too
If you miss an important confounder, your estimates are biased and
inconsistent.
In the more general case with more than two covariates the bias is
more difficult to discern. It depends on all the pairwise correlations.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 82 / 132
Including an Irrelevant Variable: Simple Case
y = β0 + β1 x1 + β2 x2 + u where β2 = 0
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 83 / 132
Including an Irrelevant Variable: Simple Case
E [β̂j ] = βj
and thus including the irrelevant variable does not generally affect the
unbiasedness. The sampling distribution of β̂2 will be centered about zero.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 84 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 85 / 132
Sampling variance for simple linear regression
σu2
var(βb1 ) = Pn 2
i=1 (Xi − X )
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 86 / 132
Sampling variation for linear regression with two covariates
Regression with an additional independent variable:
σ2
var(βb1 ) = Pnu
(1 − R12 ) i=1 (Xi − X )2
Definition
Multicollinearity is defined to be high, but not perfect, correlation between
two independent variables in a regression.
σ2
var(βb1 ) = Pnu
(1 − R12 ) i=1 (Xi − X )2
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 88 / 132
Intuition for multicollinearity
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 89 / 132
Effects of multicollinearity
No effect on the bias of OLS.
Only increases the standard errors.
Really just a sample size problem:
I If Xi and Zi are extremely highly correlated, you’re going to need a
much bigger sample to accurately differentiate between their effects.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 90 / 132
How Do We Detect Multicollinearity?
The best practice is to directly compute Cor(X1 , X2 ) before running your
regression.
But you might (and probably will) forget to do so. Even then, you can
detect multicollinearity from your regression result:
I Large changes in the estimated regression coefficients when a predictor
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 92 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 93 / 132
Why Dummy Variables?
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 94 / 132
How Can I Use a Dummy Variable?
Consider the easiest case with two categories. The type of electoral
system of country i is given by:
Xi ∈ {Proportional, Majoritarian}
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 95 / 132
Example: GDP per capita on Electoral System
R Code
> summary(lm(REALGDPCAP ~ MAJORITARIAN, data = D))
Call:
lm(formula = REALGDPCAP ~ MAJORITARIAN, data = D)
Residuals:
Min 1Q Median 3Q Max
-5982 -4592 -2112 4293 13685
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7097.7 763.2 9.30 1.64e-14 ***
MAJORITARIAN -1053.8 1224.9 -0.86 0.392
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 96 / 132
Example: GDP per capita on Electoral System
R Code
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7097.7 763.2 9.30 1.64e-14 ***
MAJORITARIAN -1053.8 1224.9 -0.86 0.392
R Code
> gdp.pro <- D$REALGDPCAP[D$MAJORITARIAN == 0]
> summary(gdp.pro)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1116 2709 5102 7098 10670 20780
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 97 / 132
Example: GDP per capita on Electoral System
R Code
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7097.7 763.2 9.30 1.64e-14 ***
MAJORITARIAN -1053.8 1224.9 -0.86 0.392
R Code
> gdp.pro <- D$REALGDPCAP[D$MAJORITARIAN == 0]
> summary(gdp.pro)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1116 2709 5102 7098 10670 20780
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 98 / 132
Example: GDP per capita on Electoral System
R Code
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7097.7 763.2 9.30 1.64e-14 ***
MAJORITARIAN -1053.8 1224.9 -0.86 0.392
R Code
> gdp.pro <- D$REALGDPCAP[D$MAJORITARIAN == 0]
> summary(gdp.pro)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1116 2709 5102 7098 10670 20780
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 99 / 132
Dummy Variables for Multiple Categories
More generally, let’s say X measures which of m categories each unit
i belongs to. E.g. the type of electoral system or region of country i
is given by:
I Xi ∈ {Proportional, Majoritarian} so m = 2
I Xi ∈ {Asia, Africa, LatinAmerica, OECD, Transition} so m = 5
Dm = 1 − (D1 + · · · + Dm−1 )
Category D1 D2 D3 D4
Asia 1 0 0 0
Africa 0 1 0 0
LatinAmerica 0 0 1 0
OECD 0 0 0 1
Transition 0 0 0 0
Y = β0 + β1 D1 + β2 D2 + β3 D3 + β4 D4 + u
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 101 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 102 / 132
Why Interaction Terms?
Interaction terms will allow you to let the slope on one variable vary
as a function of another variable
Interaction terms are central in regression analysis to:
I Model and test conditional hypothesis (do the returns to education
vary by gender?)
I Make model of the conditional expectation function more realistic by
letting coefficients vary across subgroups
We can interact:
I two or more dummy variables
I dummy variables and continuous variables
I two or more continuous variables
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 103 / 132
Return to the Fish Example
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 104 / 132
Let’s see the data
7
6 Non-Muslim
Democracy
5
4
3
2
Muslim
1
7
6 Non-Muslim
Democracy
5
4
3
2
Muslim
1
Let Zi be binary
In this case, Zi = 1 for the country being Muslim
We can add another covariate to the baseline model that allows the
effect of income to vary by Muslim status.
This covariate is called an interaction term and it is the product of
the two marginal variables of interest: incomei × muslimi
Here is the model with the interaction term:
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 107 / 132
Two lines in one regression
When Zi = 1:
Ybi = βb0 + βb1 Xi + βb2 Zi + βb3 Xi Zi
= βb0 + βb1 Xi + βb2 × 1 + βb3 Xi × 1
= (βb0 + βb2 ) + (βb1 + βb3 )Xi
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 108 / 132
Example interpretation of the coefficients
Intercept for Xi Slope for Xi
Non-Muslim country (Zi = 0) βb0 βb1
Muslim country (Zi = 1) βb0 + βb2 βb1 + βb3
7
6
Democracy
5
4
3
2
1
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 109 / 132
General interpretation of the coefficients
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 110 / 132
Lower order terms
Principle of Marginality: Always include the marginal effects
(sometimes called the lower order terms)
Imagine we omitted the lower order term for muslim:
6
Democracy
4
2
0
0 1 2 3 4
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 111 / 132
Omitting lower order terms
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 112 / 132
Interactions with two continuous variables
incomei × growthi
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 113 / 132
Interpretation
With a continuous Zi , we can have more than two values that it can
take on:
Intercept for Xi Slope for Xi
Zi =0 βb0 βb1
Zi = 0.5 βb0 + βb2 × 0.5 βb1 + βb3 × 0.5
Zi =1 βb0 + βb2 × 1 βb1 + βb3 × 1
Zi =5 βb0 + βb2 × 5 βb1 + βb3 × 5
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 114 / 132
General interpretation
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 115 / 132
Additional Assumptions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 116 / 132
Example: Common Support
Chapman 2009 analysis
example and reanalysis from Hainmueller, Mummolo, Xu 2016
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 117 / 132
Example: Common Support
Chapman 2009 analysis
example and reanalysis from Hainmueller, Mummolo, Xu 2016
UN authorization = 0
50
●
● ●● ●
● ●
●
●
●
● ●● ● ● ●● ●
●● ● ●
● ● ●●
● ●
● ●● ● ●● ●
● ●
●●● ● ● ● ●● ●
● ●●
0 ● ●●
●●●
●
●●
●
● ●
●● ●
●●●
●●●
●●
●
●
●
●
●
●
●●●
● ● ●
●
●● ●
●●
● ●●
● ●●
●●
●
●●
● ●
● ●●●● ●
● ● ●
●●
●
●
● ●●● ●
●
●
● ● ●
●
●
●
●
●● ●
●●
●● ●●
● ●
●● ●
●
●
−50
●
rallies
UN authorization = 1
50
●
●
● ●
0 ●
●
−50
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 117 / 132
Summary for Interactions
Do not omit lower order terms (unless you have a strong theory that tells
you so) because this usually imposes unrealistic restrictions.
Do not interpret the coefficients on the lower terms as marginal effects (they
give the marginal effect only for the case where the other variable is equal to
zero)
Produce tables or figures that summarize the conditional marginal effects of
the variable of interest at plausible different levels of the other variable; use
correct formula to compute variance for these conditional effects (sum of
coefficients)
In simple cases the p-value on the interaction term can be used as a test
against the null of no interaction, but significant tests for the lower order
terms rarely make sense.
Further Reading: Brambor, Clark, and Golder. 2006. Understanding Interaction
Models: Improving Empirical Analyses. Political Analysis 14 (1): 63-82.
Hainmueller, Mummolo, Xu. 2016. How Much Should We Trust Estimates from
Multiplicative Interaction Models? Simple Tools to Improve Empirical Practice.
Working Paper
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 118 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 119 / 132
Polynomial terms
Y = β0 + β1 X1 + β2 X2 + β3 X1 X2 + u
Y = β0 + (β1 + β2 )X1 + β3 X1 X1 + u
Y = β0 + β˜1 X1 + β˜2 X12 + u
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 120 / 132
dratic age effect
Polynomial Example: Income and Age
25
Let’s look at data from the
define U.S.
xi toandbe agethe
for
●● ● ●● ●● ● ●● ●
●
●● ●● ●●● ●● ● ●●● ● ●● ●
● ●●● ●●● ●●●●● ●●
●● ●● ●●
●●●●
● ●● ●●●● ● ● ●
● ●●● ●● ●●● ●● ●●● ●● ●● ●●
●●●
●●● ● ●
examine ● ● ● ●●
● ●●
● ●●
●● ●●● ●●●
●●
●● ●
●
●●
●
● ●●
●●●●●●●
●●●●●
●●● ●
●
●
●●●
● ●
●●●
●●
●
●●
●●●●●●●
●●
● ●
●●●●●
●●● ●
●●●●●●●
●●
● ●
●●●●●● ●
●●
●
● ●●
●
●● ●
● ●
20
●
●● ●●● ●●●●
●● ●●●●
●● ●
●● ● ●●●●● ●● ● ● ● ●●
●●●●
● ●●● ●
●● ●●● ●
●● ● ●● ●● ●● ●
relationship Y: income ●
●●
●● ●●●●●●●●●●●●
●●
●●● ●●
● ●●
● ●● ●● ● ●
● ●●●● ●
●● ●●●●
● ●
●●●
●● ● ●●● ●
● ●●●● ● ● ●● ●●●● ●●●
●●●
●
● ●●
● ●● ●●● ● ● ● ●●
● ●● ● ● ●
and X: age
gory,
● ●● ●●●● ● ● ●● ●●● ● ●● ● ●
●●
● ●●
●●●●●● ● ●●●●● ● ●●
●● ●● ● ●● ●● ●●
● ●● ●
●● ●●● ● ●● ●● ● ●● ●●● ● ●●● ●●● ● ●● ●
● ●●
●●●● ●
●●●●●
●●● ●●
● ●●●● ●● ● ● ●●
15
● ● ●●●
● ●● ● ●● ● ● ● ●●● ●●●●●●●●
●●●● ● ●●●
jitter(income)
●● ● ● ●●● ●●●●
●●
● ●●●
● ● ●●● ●● ● ●
● ●●● ● ●
● ●●● ●●●●●●●
●● ●
● ●● ● ● ● ●●● ●●● ● ●
10
●●● ● ● ● ● ●
β̂0data i β̂1well:
● ● ● ●
● ●
● ● ● ● ●● ● ●●●
● ●●
● ● ●●● ● ●● ●● ●● ●
●● ● ●● ● ●●● ● ●
Y = β0 + β1 X1 + u ●● ● ● ● ● ● ● ● ●●
5
● ● ● ● ●
● ● ● ●● ● ●● ●● ● ●●●● ● ● ●
● ●● ● ● ●●
A second order polynomial in ● ●
●●
●●● ●
● ● ● ●● ●
● ● ● ●
0
Y = β0 + β1 X1 + β2 X12 + u 20 40 60 80
jitter(age)
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 121 / 132
dratic age effect
Polynomial Example: Income and Age
Y = β0 + β1 X1 + β2 X12 + u
Is β1 the marginal effect of age
25
define onx income?
to be age for
●● ● ●● ●● ● ●● ●●
●● ●●●●● ● ●●● ● ●● ●
● ●●● ●●● ●●● ●●
●●●●
● ●●
●● ●●
●●●●
● ● ●●●●
● ●●● ● ●
i
● ●●● ●● ●●● ●● ●●● ●● ●●●●●
●●● ● ●
● ●● ● ● ● ●● ●
● ● ● ●●● ●●
●●●●●●● ●●● ● ●● ● ● ●●● ●● ● ●● ● ●
●●● ●●● ●●●●●●●●●
●● ●● ●
● ●●
●● ●●● ●●●
●●
●● ●
●●
● ●●●●
●
●●●●● ●●●●● ●●
●●●●● ●●●● ● ●
● ●●
20
●●●●
● ●●●●
●●
●●
●●●●●●●●
●● ●●●●
●
●● ●● ●●●●
●● ●
●● ● ●●
●●●
● ●
● ●●
●●●●● ● ●
●● ● ●● ● ● ● ● ●●
15
● ● ●●●
● ●● ● ●● ● ● ● ●●● ●●●● ●●●●●●●●●
●●●
jitter(income)
●● ● ● ●●● ●●●●●●
● ●●●● ● ●●● ●● ● ●
1 ● ●●● ● ●
● ●●● ●●●●●●● ●● ●
● ●● ● ● ● ●●● ●●● ● ●
Here the effect of age changes ●●●●● ● ● ●● ● ● ● ●● ●
●●● ● ● ● ● ●● ●
●● ● ● ●●● ●● ●
● ● ● ● ●● ●●● ● ● ●●●●● ● ●● ● ●
monotonically from positive to ● ●● ● ● ● ● ●
● ● ● ● ●●●
xi2 β̂2
● ● ● ●● ● ●
ŷi = + xi β̂with
10
●●● ● ● ● ● ●
β̂0negative 1 +income.
● ● ● ● ● ●
● ● ● ● ●● ● ●●●
● ●●
● ● ●●● ● ●● ●● ●● ●
●● ● ●● ● ●●● ● ●
●● ● ● ● ● ●●
If β2 > 0 we get a U-shape, ● ● ●
5
● ● ● ● ●
● ● ● ●● ● ●● ●● ● ●●●
● ● ● ●
2 < 0 we get an ●
●●
● ●●●
●
● ● ● ●
●
●
● ● ● ●● ● ●
e data.
●● ● ● ● ●● ●
inverted U-shape. 0
●●● ●
●●● ● ● ● ● ● ● ● ● ● ● ●
Maximum/Minimum occurs at 20 40 60 80
β1
| 2β 2
|. Here turning point is at jitter(age)
X1 = 50.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 122 / 132
Higher Order Polynomials
Approximating data generated with a sine function. Red line is a first degree
polynomial, green line is second degree, orange line is third degree and blue is
fourth degree
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 123 / 132
Conclusion
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 124 / 132
Next Week
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 125 / 132
1 Two Examples
2 Adding a Binary Variable
3 Adding a Continuous Covariate
4 Once More With Feeling
5 OLS Mechanics and Partialing Out
6 Fun With Red and Blue
7 Omitted Variables
8 Multicollinearity
9 Dummy Variables
10 Interaction Terms
11 Polynomials
12 Conclusion
13 Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 126 / 132
Fun With Interactions
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 127 / 132
Original Argument
Public preferences shape welfare state trajectories over the long term
Democracy empowers the masses, and that empowerment helps
define social outcomes
Key model is interaction between liberal/non-liberal and public
preferences on social spending
but. . . they leave out a main effect.
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 128 / 132
Omitted Term
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 129 / 132
What Happens?
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 130 / 132
Moral of the Story
<drops mic>
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 131 / 132
References
Stewart (Princeton) Week 6: Two Regressors October 17, 19, 2016 132 / 132