-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path09-class.Rmd
278 lines (178 loc) Β· 5.08 KB
/
09-class.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
---
title: "Class 9: Diff-in-diff II"
author: "Andrew Heiss"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
lib_dir: "libs"
chakra: "libs/remark-latest.min.js"
css: ["default", "css/ath-slides.css", "css/ath-inferno-fonts.css", "css/animate.css"]
seal: false
anchor_sections: false
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
ratio: "16:9"
navigation:
scroll: false
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(warning = FALSE, message = FALSE,
fig.retina = 3, fig.align = "center")
```
```{r packages-data, include=FALSE}
library(tidyverse)
library(ggdag)
library(palmerpenguins)
library(modelsummary)
```
```{r xaringanExtra, echo=FALSE}
xaringanExtra::use_xaringan_extra(c("tile_view"))
```
class: center middle main-title section-title-3
# In-person<br>session 9
.class-info[
**March 9, 2023**
.light[PMAP 8521: Program evaluation<br>
Andrew Young School of Policy Studies
]
]
---
name: outline
class: title title-inv-8
# Plan for today
--
.box-3.medium[General questions]
--
.box-7.medium[Final project]
--
.box-1.medium[Simple diff-in-diff]
--
.box-6.medium[Two-way fixed effects]
--
.box-2.medium[Markdown fun]
---
layout: false
name: general-questions
class: center middle section-title section-title-3 animated fadeIn
# General questions
---
class: middle
.box-3.large[Should we control for variables<br>to close as many backdoors as<br>possible in our diff-in-diff model?]
---
class: title title-3
# Design-based identification
.box-inv-3[Use a special situation to isolate arrow]
.pull-left[
.box-3[RCTs]
.box-inv-3.small[Use randomization<br>to remove confounding]
.center[
<figure>
<img src="05-slides_files/figure-html/experimental-dag-1.png" alt="RCT DAG" title="RCT DAG" width="60%">
</figure>
]
]
--
.pull-right[
.box-3[Difference-in-differences]
.box-inv-3.small[Use before/after & treatment/control<br>differences to remove confounding]
.center[
<figure>
<img src="08-slides_files/figure-html/min-wage-dag-1.png" alt="Diff-in-diff DAG" title="Diff-in-diff DAG" width="90%">
</figure>
]
]
---
layout: true
class: middle
---
.box-3.large[How does moving time back<br>let us check for parallel trends?]
---
.center[
<figure>
<img src="img/08-class/mm-fig-5-4.png" alt="Mastering Metrics Figure 5.4" title="Mastering Metrics Figure 5.4" width="65%">
</figure>
]
---
.box-3.large[Can you conduct diff-in-diff<br>with a binary outcome?]
???
- <https://www.andrewheiss.com/blog/2021/11/08/beta-regression-guide/#1-linear-probability-models>
- <https://bayesf22-notebook.classes.andrewheiss.com/bayes-rules/13-chapter.html#prelude-ii-how-to-interpret-logistic-regression-coefficients>
---
layout: false
name: final-project
class: center middle section-title section-title-7 animated fadeIn
# Final project
---
class: middle
.box-7.large[Tell us more about<br>the final project!]
---
layout: false
name: diff-in-diff
class: center middle section-title section-title-1 animated fadeIn
# Simple diff-in-diff
---
layout: true
class: middle
---
.box-1.large[Minimum legal drinking age]
---
.box-inv-1.medium[MLDA reduction]
.box-1.medium[Two states: Alabama vs. Arkansas]
$$\begin{aligned}
\text{Mortality}\ =&\ \beta_0 + \beta_1\ \text{Alabama} + \beta_2\ \text{After 1975}\ + \\
&\ \beta_3\ (\text{Alabama} \times \text{After 1975})
\end{aligned}$$
---
layout: false
name: twfe
class: center middle section-title section-title-6 animated fadeIn
# Two-way fixed effects<br>(TWFE)
---
layout: true
class: middle
---
.box-6.medium[Two states: Alabama vs. Arkansas]
$$\begin{aligned}
\text{Mortality}\ =&\ \beta_0 + \beta_1\ \text{Alabama} + \beta_2\ \text{After 1975}\ + \\
&\ \beta_3\ (\text{Alabama} \times \text{After 1975})
\end{aligned}$$
---
.box-6.medium[All states: `Treatment == 1`<br>if legal for 18-20-year-olds to drink]
$$\text{Mortality}\ =\ \beta_0 + \beta_1\ \text{Treatment} + \beta_2\ \text{State} + \beta_3\ \text{Year}$$
---
$$\begin{aligned}
\text{Mortality}\ =&\ \beta_0 + \beta_1\ \text{Alabama} + \beta_2\ \text{After 1975}\ + \\
&\ \color{red}{\beta_3}\ (\text{Alabama} \times \text{After 1975})
\end{aligned}$$
.center[vs.]
$$\text{Mortality}\ =\ \beta_0 + \color{red}{\beta_1}\ \text{Treatment} + \beta_2\ \text{State} + \beta_3\ \text{Year}$$
---
.center[
<figure>
<img src="img/08-class/mm-tbl-5-2.png" alt="Mastering Metrics Table 5.2" title="Mastering Metrics Table 5.2" width="55%">
</figure>
]
---
.box-6.large[What about this<br>staggered treatment stuff?]
.box-inv-6[[See this](https://www.andrewheiss.com/blog/2021/08/25/twfe-diagnostics/)]
???
This is good for ethical reasons!
Blog post
---
.box-6.large[What are random effects?]
.box-inv-6[[See this](https://www.andrewheiss.com/blog/2021/12/01/multilevel-models-panel-data-guide/)]
---
layout: false
name: quarto
class: center middle section-title section-title-2 animated fadeIn
# Bonus fun with<br>R Markdown and Quarto
---
layout: true
class: middle
---
.box-2.large.sp-after[Documents]
.box-2.large[Websites]