-
Notifications
You must be signed in to change notification settings - Fork 241
Expand file tree
/
Copy pathabortion_ddd2.R
More file actions
30 lines (27 loc) · 1.04 KB
/
Copy pathabortion_ddd2.R
File metadata and controls
30 lines (27 loc) · 1.04 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
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),
younger2 = case_when(age == 20 ~ 1, TRUE ~ 0),
yr2 = as_factor(case_when(repeal == 1 & younger2 == 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))
)
regddd <- abortion %>%
filter(bf == 1 & (age == 20 | age ==25)) %>%
lm_robust(lnr ~ repeal*year + acc + ir + pi + alcohol + crack + poverty + income + ur,
data = ., weights = totpop, clusters = fip)