-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhite_subsample.R
53 lines (43 loc) · 2.08 KB
/
white_subsample.R
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
### SURVEY DESIGN
white_sub <- full_cmps %>% filter(S2_Race_Prime == 1 & Hispanic == 0 &
distance_km < 965.606)
white_cmps <- svydesign(id = ~ 1, weights = ~race_weight, data = white_sub)
## Base Model
base <- list()
base[[1]] <- c("distance_km","Party_5pt",
"Education", "Age", "Income")
base[[2]] <- c("dist_sqd","Party_5pt",
"Education", "Age", "Income")
# base[[3]] <- c("distance_km","Party_5pt",
# "Education", "Age", "Income", "Inclusive")
# base[[4]] <- c("dist_sqd","Party_5pt",
# "Education", "Age", "Income", "Inclusive")
## Mods
bin_function(dvs_binomial, base,white_cmps, white_sub, "base_white_bin")
ols_function(dvs_ols, base,white_cmps, white_sub, "base_white_ols")
## Full Table
stargazer(base_white_bin, base_white_ols, type = "latex",
dep.var.labels = c("Increase Border Spending",
"Border Security as a National Priority"))
### Most inclusive vs least inclusive sub-sample
l_inc <- white_sub %>% filter(Inclusive == 0)
m_inc <- white_sub %>% filter(Inclusive == 1)
# svy design
l_cmps <- svydesign(id = ~ 1, weights = ~race_weight, data = l_inc)
m_cmps <- svydesign(id = ~ 1, weights = ~race_weight, data = m_inc)
# least inc
bin_function(dvs_binomial, base,l_cmps, l_inc, "linc_white_bin")
ols_function(dvs_ols, base,l_cmps, l_inc, "linc_white_ols")
# most inc
bin_function(dvs_binomial, base,m_cmps, m_inc, "minc_white_bin")
ols_function(dvs_ols, base,m_cmps, m_inc, "minc_white_ols")
stargazer(linc_white_bin, minc_white_bin, linc_white_ols, minc_white_ols,
type = "text",
dep.var.labels = c("Increase Border Spending",
"Border Security as a National Priority"),
column.labels = c("Least Inclusive", "Least Inclusive", "Most Inclusive",
"Most Inclusive","Least Inclusive","Least Inclusive",
"Most Inclusive", "Most Inclusive"))
### MARGINAL EFFECTS
m <- margins(base_white_bin$Increase_Border_Spending[[2]], design = white_cmps)
plot(m)