Gov 2000: 11. Interactions, F-tests, and Nonlinearities Matthew Blackwell November 15, 2016 1 / 62
1. Interactions 2. Nonlinear functional forms 3. Tests of multiple hypotheses 2 / 62
Where are we? Where are we going? ends 3 / 62 • Last few weeks: adding one variable to the bivariate regression • This week: efgects that vary between groups and other loose • Next week: regression diagnostics.
1/ Interactions 4 / 62
conditional on treatment. Two binary covariates women. 5 / 62 𝑧 𝑗 = 𝛾 0 + 𝛾 1 𝑦 𝑗 + 𝛾 2 𝑨 𝑗 + 𝑣 𝑗 • Social pressure experiment: ▶ 𝑧 𝑗 = 1 for voted ▶ 𝑦 𝑗 = 1 for neighbors treatment, 𝑦 𝑗 = 0 for civil duty mailer ▶ 𝑨 𝑗 = 1 for female, 𝑨 𝑗 = 0 for male • Parameters: ▶ 𝛾 0 : average turnout for males in the control group. ▶ 𝛾 1 : efgect of neighbors treatment conditional on gender. ▶ 𝛾 2 : average difgerence in turnout between women and men • 𝛾 1 averages across the efgect for men and the efgect for
Interactions women separately? 1. Subset the data to men and women and run separate regressions. one another. 2. Include an interaction between the treatment and gender: 6 / 62 • How to allow to estimate the efgect of neighbors for men and ▶ No way to assess whether or not the efgects are difgerent from ▶ Add a third covariate that is 𝑦 𝑗 × 𝑨 𝑗 : 𝑧 𝑗 = 𝛾 0 + 𝛾 1 𝑦 𝑗 + 𝛾 2 𝑨 𝑗 + 𝛾 3 𝑦 𝑗 𝑨 𝑗 + 𝑣 𝑗 ▶ 𝑦 𝑗 × 𝑨 𝑗 = 1 for treated females ( 𝑦 𝑗 = 1 and 𝑨 𝑗 = 1 ), 0 otherwise
= 𝛾 0 Binary interactions 7 / 62 𝔽[𝑧 𝑗 |𝑦 𝑗 , 𝑨 𝑗 ] = 𝛾 0 + 𝛾 1 𝑦 𝑗 + 𝛾 2 𝑨 𝑗 + 𝛾 3 𝑦 𝑗 𝑨 𝑗 • 𝛾 1 is the efgect of treatment for men ( 𝑨 𝑗 = 0 ): 𝔽[𝑧 𝑗 |𝑦 𝑗 = 1, 𝑨 𝑗 = 0] = 𝛾 0 + 𝛾 1 × 1 + 𝛾 2 × 0 + 𝛾 3 × 1 × 0 = 𝛾 0 + 𝛾 1 𝔽[𝑧 𝑗 |𝑦 𝑗 = 0, 𝑨 𝑗 = 0] = 𝛾 0 + 𝛾 1 × 0 + 𝛾 2 × 0 + 𝛾 3 × 0 × 0 • 𝛾 1 + 𝛾 3 is the efgect of treatment for women ( 𝑨 𝑗 = 1 ): 𝔽[𝑧 𝑗 |𝑦 𝑗 = 1, 𝑨 𝑗 = 1] = 𝛾 0 + 𝛾 1 + 𝛾 2 + 𝛾 3 𝔽[𝑧 𝑗 |𝑦 𝑗 = 0, 𝑨 𝑗 = 1] = 𝛾 0 + 𝛾 2 • 𝛾 3 is the difgerence in efgects between women and men.
Hypothesis tests ̂ 𝛾 3 ] ̂ 𝛾 3 ̂ gender? enough” for us to say that the efgect varies systematically by 8 / 62 the exact same efgect. 𝛾 3 𝑦 𝑗 𝑨 𝑗 𝑧 𝑗 = ̂ 𝛾 0 + ̂ 𝛾 1 𝑦 𝑗 + ̂ 𝛾 2 𝑨 𝑗 + ̂ • Due to sampling variation, men and women will never have ▶ ⇝ ̂ 𝛾 3 not exactly equal to 0 even if 𝛾 3 = 0 . • But how do we asses if the difgerences in the efgects are “big • We can test whether or not the efgects for the two groups are difgerent by testing the null hypothesis 𝐼 0 ∶ 𝛾 3 = 0 se [ ̂
Social pressure example ## 0.00321 0.00687 0.47 0.63990 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## Residual standard error: 0.475 on 76415 degrees of freedom 0.00073 *** ## Multiple R-squared: 0.00469, Adjusted R-squared: 0.00465 ## F-statistic: 120 on 3 and 76415 DF, p-value: <2e-16 ## treat:female -3.38 summary(lm(voted ~ treat * female, data = social)) 93.97 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 0.32274 0.00343 < 2e-16 *** 0.00486 ## treat 0.06180 0.00486 12.72 < 2e-16 *** ## female -0.01640 9 / 62
A note on linearity function of the parameters: covariates we don’t observe. (binary/categorical), but is satisfjed in saturated models. parameters as there are combinations of the covariates. the covariates. 10 / 62 • The linearity assumption says we can write 𝑧 𝑗 as a linear 𝑧 𝑗 = 𝛾 0 + 𝛾 1 𝑦 𝑗 + 𝛾 2 𝑨 𝑗 + 𝛾 3 𝑦 𝑗 𝑨 𝑗 + 𝑣 𝑗 • Linearity allows us to extrapolate to combinations of the • Linearity is usually violated when non-continuous outcomes • A saturated model is one with discrete covariates and as many ▶ Same as estimating separate means for each combination of ▶ No extrapolation ⇝ linearity holds by construction.
𝑦 𝑗 . Saturated bivariate regression 11 / 62 𝑧 𝑗 = 𝛾 0 + 𝛾 1 𝑦 𝑗 + 𝑣 𝑗 • If 𝑦 𝑗 is binary: 𝐹[𝑧 𝑗 |𝑦 𝑗 = 0] = 𝛾 0 𝐹[𝑧 𝑗 |𝑦 𝑗 = 1] = 𝛾 0 + 𝛾 1 • Model is saturated: 𝛾 1 is the difgerence in CEFs between 𝑦 𝑗 = 1 and 𝑦 𝑗 = 0 . ▶ No extrapolation, no linearity assumption. • Compare this to when 𝑦 𝑗 is continuous: 𝐹[𝑧 𝑗 |𝑦 𝑗 = 𝑦] = 𝛾 0 + 𝛾 1 × 𝑦 𝐹[𝑧 𝑗 |𝑦 𝑗 = 𝑦 + 1] = 𝛾 0 + 𝛾 1 × (𝑦 + 1) • Linearity assumes the efgect ( 𝛾 1 ) is constant across values of
Saturated model example 𝔽[𝑧 𝑗 |𝑦 𝑗 , 𝑨 𝑗 ] : model. 12 / 62 𝑧 𝑗 = 𝛾 0 + 𝛾 1 𝑦 𝑗 + 𝛾 2 𝑨 𝑗 + 𝛾 3 𝑦 𝑗 𝑨 𝑗 + 𝑣 𝑗 • Four possible values of 𝑦 𝑗 and 𝑨 𝑗 , four possible values of 𝐹[𝑧 𝑗 |𝑦 𝑗 = 0, 𝑨 𝑗 = 0] = 𝛾 0 𝐹[𝑧 𝑗 |𝑦 𝑗 = 1, 𝑨 𝑗 = 0] = 𝛾 0 + 𝛾 1 𝐹[𝑧 𝑗 |𝑦 𝑗 = 0, 𝑨 𝑗 = 1] = 𝛾 0 + 𝛾 2 𝐹[𝑧 𝑗 |𝑦 𝑗 = 1, 𝑨 𝑗 = 1] = 𝛾 0 + 𝛾 1 + 𝛾 2 + 𝛾 3 • With binary covariates, including all interactions saturates the • ⇝ OK to use this model with a binary outcome.
One continuous, one binary covariate more democracy? free) to 7 (more free) 13 / 62 • How do interactions work when a variable is continuous? • Data comes from Fish (2002), “Islam and Authoritarianism.” • Basic relationship: does more economic development lead to • We measure economic development with log GDP per capita • We measure democracy with a Freedom House score, 1 (less
Let’s see the data high wealth due to natural resources, but also low levels of democracy. 14 / 62 7 6 Non-Muslim 5 Democracy 4 3 2 Muslim 1 2.0 2.5 3.0 3.5 4.0 4.5 Log GDP per capita • Want to control for Muslim countries since they tend to have
Controlling for religion ## 0.238 -7.07 5.8e-11 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## Residual standard error: 1.28 on 146 degrees of freedom ## muslim ## Multiple R-squared: 0.522, Adjusted R-squared: 0.515 ## F-statistic: 79.6 on 2 and 146 DF, p-value: <2e-16 -1.683 1.3e-14 *** 15 / 62 Estimate Std. Error t value Pr(>|t|) 0 otherwise mod <- lm(fhrev ~ income + muslim, data = FishData) summary(mod) ## ## Coefficients: ## ## (Intercept) 8.58 0.189 0.556 0.34 0.73 ## income 1.397 0.163 • muslim is 1 when Islam is the largest religion in a country and
Plotuing the lines 16 / 62 7 6 Non-Muslim 5 Democracy 4 3 2 Muslim 1 2.0 2.5 3.0 3.5 4.0 4.5 Log GDP per capita • But the regression is a poor fjt for Muslim countries • Can we allow for difgerent slopes for each group?
Interactions with a binary variable ⋮ 1 𝑦 2 𝑨 2 ⋮ ⋮ ⋮ 1 1 𝑦 𝑜 𝑨 𝑜 ⎤ ⎥ ⎥ ⎥ ⎦ 𝑨 1 𝑦 1 ⎣ 𝐘 = of interest: ̂ 𝛾 3 𝑦 𝑗 𝑨 𝑗 17 / 62 ⎡ ⎢ ⎢ ⎢ • In this case, 𝑨 𝑗 = 1 for the country being Muslim • Interaction term is the product of the two marginal variables 𝑗𝑜𝑑𝑝𝑛𝑓 𝑗 × 𝑛𝑣𝑡𝑚𝑗𝑛 𝑗 • Here is the model with the interaction term: 𝑧 𝑗 = ̂ 𝛾 0 + ̂ 𝛾 1 𝑦 𝑗 + ̂ 𝛾 2 𝑨 𝑗 + ̂ • Thus, the design matrix, 𝐘 looks like this: 𝑦 1 × 𝑨 1 𝑦 2 × 𝑨 2 𝑦 𝑜 × 𝑨 𝑜
Interaction model 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## income:muslim -2.427 0.364 -6.66 5.2e-10 *** ## --- ## Signif. codes: ## 5.06 ## Residual standard error: 1.13 on 145 degrees of freedom ## Multiple R-squared: 0.634, Adjusted R-squared: 0.626 ## F-statistic: 83.6 on 3 and 145 DF, p-value: <2e-16 1.2e-06 *** 1.134 18 / 62 -1.349 mod.int <- lm(fhrev ~ income * muslim, data = FishData) summary(mod.int) ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 0.540 5.741 -2.50 0.014 * ## income 1.859 0.159 11.70 < 2e-16 *** ## muslim • Easier/better to write the interaction term as first*second :
Data matrix with interactions 3.188 1 3.762 0 0.000 ## 5 1 0 0.000 0.000 ## 6 1 4.436 0 0.000 ## 4 0 head(model.matrix(mod.int)) 2.925 ## (Intercept) income muslim income:muslim ## 1 1 2.925 1 ## 2 2.824 1 3.214 1 3.214 ## 3 1 19 / 62
Two lines in one regression ̂ 𝛾 3 )𝑦 𝑗 ̂ 𝛾 1 𝑦 𝑗 ̂ 20 / 62 𝛾 3 𝑦 𝑗 𝑨 𝑗 𝑧 𝑗 = ̂ 𝛾 0 + ̂ 𝛾 1 𝑦 𝑗 + ̂ 𝛾 2 𝑨 𝑗 + ̂ • When 𝑨 𝑗 = 0 : 𝑧 𝑗 = ̂ 𝛾 0 + ̂ • When 𝑨 𝑗 = 1 : 𝑧 𝑗 = ( ̂ 𝛾 0 + ̂ 𝛾 2 ) + ( ̂ 𝛾 1 + ̂
Graphing interactions ̂ Intercept for 𝑦 𝑗 𝛾 3 ̂ 𝛾 2 21 / 62 𝛾 1 𝛾 0 ̂ Slope for 𝑦 𝑗 ̂ Non-Muslim country ( 𝑨 𝑗 = 0 ) 𝛾 0 + ̂ 𝛾 1 + ̂ Muslim country ( 𝑨 𝑗 = 1 ) 7 6 5 Democracy 4 3 2 1 2.0 2.5 3.0 3.5 4.0 4.5 Log GDP per capita
Recommend
More recommend