Repository navigation
Expand file tree
/
Copy pathabortion_ddd.R
More file actions
43 lines (38 loc) · 1.55 KB
/
Copy pathabortion_ddd.R
File metadata and controls
43 lines (38 loc) · 1.55 KB
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
library(tidyverse)
library(haven)
library(estimatr)
read_data <- function(df)
{
full_path <- paste("https://github.com/scunning1975/mixtape/raw/master/",
df, sep = "")
df <- read_dta(full_path)
return(df)
}
abortion <- read_data("abortion.dta") %>%
mutate(
repeal = as_factor(repeal),
year = as_factor(year),
fip = as_factor(fip),
fa = as_factor(fa),
younger = as_factor(younger),
yr = as_factor(case_when(repeal == 1 & younger == 1 ~ 1, TRUE ~ 0)),
wm = as_factor(case_when(wht == 1 & male == 1 ~ 1, TRUE ~ 0)),
wf = as_factor(case_when(wht == 1 & male == 0 ~ 1, TRUE ~ 0)),
bm = as_factor(case_when(wht == 0 & male == 1 ~ 1, TRUE ~ 0)),
bf = as_factor(case_when(wht == 0 & male == 0 ~ 1, TRUE ~ 0))
) %>%
filter(bf == 1 & (age == 15 | age == 25))
regddd <- lm_robust(lnr ~ repeal*year + younger*repeal + younger*year + yr*year + fip*t + acc + ir + pi + alcohol + crack + poverty + income + ur,
data = abortion, weights = totpop, clusters = fip)
abortion_plot <- tibble(
sd = regddd$std.error[110:124],
mean = regddd$coefficients[110:124],
year = c(1986:2000))
abortion_plot %>%
ggplot(aes(x = year, y = mean)) +
geom_rect(aes(xmin=1986, xmax=1992, ymin=-Inf, ymax=Inf), fill = "cyan", alpha = 0.01)+
geom_point()+
geom_text(aes(label = year), hjust=-0.002, vjust = -0.03)+
geom_hline(yintercept = 0) +
geom_errorbar(aes(ymin = mean-sd*1.96, ymax = mean+sd*1.96), width = 0.2,
position = position_dodge(0.05))