Commit
·
9f40d60
1
Parent(s):
7c6fd7b
git add 4
Browse files- .gitattributes +2 -1
- 4/paper.pdf +3 -0
- 4/replication_package/acs.RData +3 -0
- 4/replication_package/an_blacks.R +149 -0
- 4/replication_package/an_descriptives.R +78 -0
- 4/replication_package/an_main.R +150 -0
- 4/replication_package/an_non_racial.R +118 -0
- 4/replication_package/an_retired.R +152 -0
- 4/replication_package/an_robust.R +650 -0
- 4/replication_package/dta.RData +3 -0
- 4/replication_package/racial_flux.RData +3 -0
- 4/replication_package/readme.txt +3 -0
- 4/should_reproduce.txt +3 -0
.gitattributes
CHANGED
|
@@ -57,7 +57,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 58 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.csv filter=lfs diff=lfs merge=lfs -text
|
| 60 |
-
|
| 61 |
*.dta filter=lfs diff=lfs merge=lfs -text
|
| 62 |
*.sav filter=lfs diff=lfs merge=lfs -text
|
| 63 |
*.xls filter=lfs diff=lfs merge=lfs -text
|
|
@@ -66,3 +65,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 66 |
*.rds filter=lfs diff=lfs merge=lfs -text
|
| 67 |
*.txt filter=lfs diff=lfs merge=lfs -text
|
| 68 |
*.dat filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 57 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 58 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 60 |
*.dta filter=lfs diff=lfs merge=lfs -text
|
| 61 |
*.sav filter=lfs diff=lfs merge=lfs -text
|
| 62 |
*.xls filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 65 |
*.rds filter=lfs diff=lfs merge=lfs -text
|
| 66 |
*.txt filter=lfs diff=lfs merge=lfs -text
|
| 67 |
*.dat filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
*.pdf filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
4/paper.pdf filter=lfs diff=lfs merge=lfs -text
|
4/paper.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17d81e44bfd9a2a11d4566c6631e04fca53554344f9146321fd9e1d3858dbfab
|
| 3 |
+
size 1651200
|
4/replication_package/acs.RData
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2f5dc507fd2ad95a56dd05a9a0544cf1d9d0708fe3350fb5d568f36f2f2a0494
|
| 3 |
+
size 590945
|
4/replication_package/an_blacks.R
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Voting and racial attitudes (blacks only)
|
| 2 |
+
## Brian T. Hamel and Bryan Wilcox-Archuleta
|
| 3 |
+
## First: 24 September 2019
|
| 4 |
+
## Last: 19 March 2020
|
| 5 |
+
|
| 6 |
+
## Loading packages
|
| 7 |
+
## install.packages(c("estimatr", "tidyverse", "magrittr", "texreg", "gridExtra", "scales"))
|
| 8 |
+
library(estimatr)
|
| 9 |
+
library(tidyverse)
|
| 10 |
+
library(magrittr)
|
| 11 |
+
library(texreg)
|
| 12 |
+
library(gridExtra)
|
| 13 |
+
library(scales)
|
| 14 |
+
|
| 15 |
+
## Loading data
|
| 16 |
+
load("01_data/dta.RData")
|
| 17 |
+
|
| 18 |
+
## Create shell
|
| 19 |
+
shell = dta %>% filter(black == 1) %$%
|
| 20 |
+
expand.grid(racial_flux = seq(min(racial_flux, na.rm = TRUE), max(racial_flux, na.rm = TRUE), by = 1),
|
| 21 |
+
pid7 = round(mean(pid7, na.rm = TRUE), digits = 2),
|
| 22 |
+
ideo5 = round(mean(ideo5, na.rm = TRUE), digits = 2),
|
| 23 |
+
female = round(mean(female, na.rm = TRUE), digits = 2),
|
| 24 |
+
age = round(mean(age, na.rm = TRUE), digits = 2),
|
| 25 |
+
faminc = round(mean(faminc, na.rm = TRUE), digit = 2),
|
| 26 |
+
educ = round(mean(educ, na.rm = TRUE), digits = 2),
|
| 27 |
+
pct_white = round(mean(pct_white, na.rm = TRUE), digits = 2),
|
| 28 |
+
pct_black = round(mean(pct_black, na.rm = TRUE), digits = 2),
|
| 29 |
+
pct_unemployed = round(mean(pct_unemployed, na.rm = TRUE), digits = 2),
|
| 30 |
+
pct_college = round(mean(pct_college, na.rm = TRUE), digits = 2),
|
| 31 |
+
log_per_cap_inc = round(mean(log_per_cap_inc, na.rm = TRUE), digits = 2),
|
| 32 |
+
gini = round(mean(gini, na.rm = TRUE), digits = 2),
|
| 33 |
+
south = round(mean(south, na.rm = TRUE), digits = 2),
|
| 34 |
+
non_rural = round(mean(non_rural, na.rm = TRUE), digits = 2),
|
| 35 |
+
log_pop_density = round(mean(log_pop_density, na.rm = TRUE), digits = 2)) %>%
|
| 36 |
+
na.omit()
|
| 37 |
+
|
| 38 |
+
## Models and predicted probabilities
|
| 39 |
+
pres_dem = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 40 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 41 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 42 |
+
+ log_pop_density, data = dta %>% filter(black == 1),
|
| 43 |
+
clusters = zipcode, se_type = "stata")
|
| 44 |
+
|
| 45 |
+
pred_pres_dem = cbind(predict(pres_dem, shell,
|
| 46 |
+
se.fit = TRUE, type = "response"),
|
| 47 |
+
shell)
|
| 48 |
+
|
| 49 |
+
house_dem = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 50 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 51 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 52 |
+
+ log_pop_density, data = dta %>% filter(black == 1),
|
| 53 |
+
clusters = zipcode, se_type = "stata")
|
| 54 |
+
|
| 55 |
+
pred_house_dem = cbind(predict(house_dem, shell,
|
| 56 |
+
se.fit = TRUE, type = "response"),
|
| 57 |
+
shell)
|
| 58 |
+
|
| 59 |
+
rr = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 60 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 61 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 62 |
+
+ log_pop_density, data = dta %>% filter(black == 1),
|
| 63 |
+
clusters = zipcode, se_type = "stata")
|
| 64 |
+
|
| 65 |
+
pred_rr = cbind(predict(rr, shell,
|
| 66 |
+
se.fit = TRUE, type = "response"),
|
| 67 |
+
shell)
|
| 68 |
+
|
| 69 |
+
affirm = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 70 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 71 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 72 |
+
+ log_pop_density, data = dta %>% filter(black == 1),
|
| 73 |
+
clusters = zipcode, se_type = "stata")
|
| 74 |
+
|
| 75 |
+
pred_affirm = cbind(predict(affirm, shell,
|
| 76 |
+
se.fit = TRUE, type = "response"),
|
| 77 |
+
shell)
|
| 78 |
+
|
| 79 |
+
## Table of coefs., and save
|
| 80 |
+
##############
|
| 81 |
+
## TABLE A6 ##
|
| 82 |
+
##############
|
| 83 |
+
texreg(list(pres_dem, house_dem, rr, affirm),
|
| 84 |
+
file = "03_output/blacks.tex",
|
| 85 |
+
label = "blacks",
|
| 86 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Blacks)",
|
| 87 |
+
custom.model.names = c("\\textit{President}", "\\textit{U.S. House}", "\\textit{Racial Resentment}",
|
| 88 |
+
"\\textit{Affirmative Action}"),
|
| 89 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 90 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 91 |
+
"Education", "% White", "% Black",
|
| 92 |
+
"% Unemployed", "% College",
|
| 93 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 94 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 95 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1),
|
| 96 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 97 |
+
stars = c(0.05, 0.01, 0.001),
|
| 98 |
+
digits = 3,
|
| 99 |
+
center = TRUE,
|
| 100 |
+
include.ci = FALSE,
|
| 101 |
+
caption.above = TRUE)
|
| 102 |
+
|
| 103 |
+
## Plot, and save
|
| 104 |
+
pred_pres_dem = cbind(pred_pres_dem, outcome = "President")
|
| 105 |
+
pred_house_dem = cbind(pred_house_dem, outcome = "U.S. House")
|
| 106 |
+
pred_vote = bind_rows(pred_pres_dem, pred_house_dem) %>%
|
| 107 |
+
mutate(upper = fit + 1.96 * se.fit,
|
| 108 |
+
lower = fit - 1.96 * se.fit)
|
| 109 |
+
|
| 110 |
+
vote_plot = ggplot(pred_vote, aes(x = racial_flux, y = fit, ymin = lower, ymax = upper)) +
|
| 111 |
+
geom_line(color = "red4") +
|
| 112 |
+
geom_ribbon(alpha = .2, fill = "red1") +
|
| 113 |
+
facet_wrap(~ outcome, nrow = 1, scales = "free") +
|
| 114 |
+
labs(y = "Pr(Vote Democrat)",
|
| 115 |
+
x = "") +
|
| 116 |
+
geom_rug(data = dta %>% filter(black == 1), aes(x = racial_flux), inherit.aes = FALSE, sides = "b") +
|
| 117 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 118 |
+
theme(legend.title = element_blank(),
|
| 119 |
+
panel.spacing = unit(1, "lines"),
|
| 120 |
+
axis.line.y = element_blank())
|
| 121 |
+
|
| 122 |
+
pred_rr = cbind(pred_rr, outcome = "Racial Resentment")
|
| 123 |
+
pred_affirm = cbind(pred_affirm, outcome = "Affirmative Action")
|
| 124 |
+
pred_att = bind_rows(pred_rr, pred_affirm) %>%
|
| 125 |
+
mutate(upper = fit + 1.96 * se.fit,
|
| 126 |
+
lower = fit - 1.96 * se.fit)
|
| 127 |
+
pred_att$outcome = factor(pred_att$outcome, levels = c("Racial Resentment",
|
| 128 |
+
"Affirmative Action"))
|
| 129 |
+
|
| 130 |
+
###############
|
| 131 |
+
## FIGURE A2 ##
|
| 132 |
+
###############
|
| 133 |
+
att_plot = ggplot(pred_att, aes(x = racial_flux, y = fit, ymin = lower, ymax = upper)) +
|
| 134 |
+
geom_line(color = "red4") +
|
| 135 |
+
geom_ribbon(alpha = .2, fill = "red1") +
|
| 136 |
+
facet_wrap(~ outcome, nrow = 1, scales = "free") +
|
| 137 |
+
labs(y = "Predicted Attitude",
|
| 138 |
+
x = "Racial Flux") +
|
| 139 |
+
geom_rug(data = dta %>% filter(black == 1), aes(x = racial_flux), inherit.aes = FALSE, sides = "b") +
|
| 140 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 141 |
+
theme(legend.title = element_blank(),
|
| 142 |
+
panel.spacing = unit(1, "lines"),
|
| 143 |
+
axis.line.y = element_blank())
|
| 144 |
+
|
| 145 |
+
main = grid.arrange(vote_plot, att_plot, ncol = 1, nrow = 2)
|
| 146 |
+
ggsave(main, file = "03_output/blacks.png", height = 4, width = 4, units = "in", dpi = 600)
|
| 147 |
+
|
| 148 |
+
## Clear R
|
| 149 |
+
rm(list = ls())
|
4/replication_package/an_descriptives.R
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Descriptive statistics
|
| 2 |
+
## Brian T. Hamel and Bryan Wilcox-Archuleta
|
| 3 |
+
## First: 28 April 2019
|
| 4 |
+
## Last: 19 March 2020
|
| 5 |
+
|
| 6 |
+
## Loading packages
|
| 7 |
+
## install.packages(c("tidyverse", "estimatr", "ggpubr", "gridExtra", "texreg", "scales"))
|
| 8 |
+
library(tidyverse)
|
| 9 |
+
library(estimatr)
|
| 10 |
+
library(ggpubr)
|
| 11 |
+
library(gridExtra)
|
| 12 |
+
library(texreg)
|
| 13 |
+
library(scales)
|
| 14 |
+
|
| 15 |
+
## Loading Racial Flux data
|
| 16 |
+
load("01_data/lodes/racial_flux.RData")
|
| 17 |
+
|
| 18 |
+
## Loading ACS data
|
| 19 |
+
load("01_data/acs/acs.RData")
|
| 20 |
+
|
| 21 |
+
## Merging Racial Flux and ACS data
|
| 22 |
+
dta = racial_flux %>%
|
| 23 |
+
left_join(., acs, by = c("zcta" = "zip"))
|
| 24 |
+
|
| 25 |
+
## Plotting Racial Flux vs. % white and % black
|
| 26 |
+
###############
|
| 27 |
+
## FIGURE 1 ##
|
| 28 |
+
###############
|
| 29 |
+
pct_white = ggplot(dta, aes(x = pct_white, y = racial_flux)) +
|
| 30 |
+
geom_point(color = "black", shape = 1, alpha = .25) +
|
| 31 |
+
stat_smooth(method = "lm_robust", se = FALSE, lty = 2, color = "blue", show.legend = TRUE) +
|
| 32 |
+
stat_smooth(method = "loess", se = FALSE, color = "red", show.legend = TRUE) +
|
| 33 |
+
labs(x = "% White", y = "Racial Flux") +
|
| 34 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 35 |
+
theme(legend.title = element_blank()) +
|
| 36 |
+
stat_cor(method = "pearson", label.x = 2, label.y = 85, size = 2)
|
| 37 |
+
|
| 38 |
+
pct_black = ggplot(dta, aes(x = pct_black, y = racial_flux)) +
|
| 39 |
+
geom_point(color = "black", shape = 1, alpha = .25) +
|
| 40 |
+
stat_smooth(method = "lm_robust", se = FALSE, lty = 2, color = "blue", show.legend = TRUE) +
|
| 41 |
+
stat_smooth(method = "loess", se = FALSE, color = "red", show.legend = TRUE) +
|
| 42 |
+
labs(x = "% Black", y = "") +
|
| 43 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 44 |
+
theme(legend.title = element_blank()) +
|
| 45 |
+
stat_cor(method = "pearson", label.x = 2, label.y = 85, size = 2)
|
| 46 |
+
|
| 47 |
+
## Combine plots, and save
|
| 48 |
+
flux_res = grid.arrange(pct_white, pct_black, ncol = 2, nrow = 1)
|
| 49 |
+
ggsave(flux_res, file = "03_output/flux_res.png", height = 2, width = 4, units = "in", dpi = 600)
|
| 50 |
+
|
| 51 |
+
## Correlates of Racial Flux
|
| 52 |
+
correlates = lm_robust(racial_flux ~ pct_white + pct_black
|
| 53 |
+
+ pct_unemployed + pct_college + log_per_cap_inc + gini + south
|
| 54 |
+
+ non_rural + log_pop_density, data = dta, se_type = "stata")
|
| 55 |
+
|
| 56 |
+
## Save table of coefficients
|
| 57 |
+
##############
|
| 58 |
+
## TABLE A2 ##
|
| 59 |
+
##############
|
| 60 |
+
texreg(correlates,
|
| 61 |
+
file = "03_output/correlates.tex",
|
| 62 |
+
label = "correlates",
|
| 63 |
+
caption = "Multivariate Correlates of Racial Flux",
|
| 64 |
+
custom.model.names = c("(1)"),
|
| 65 |
+
custom.coef.names = c("Intercept", "% White", "% Black",
|
| 66 |
+
"% Unemployed", "% College",
|
| 67 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 68 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 69 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 1),
|
| 70 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 71 |
+
stars = c(0.05, 0.01, 0.001),
|
| 72 |
+
digits = 3,
|
| 73 |
+
center = TRUE,
|
| 74 |
+
include.ci = FALSE,
|
| 75 |
+
caption.above = TRUE)
|
| 76 |
+
|
| 77 |
+
## Clear R
|
| 78 |
+
rm(list = ls())
|
4/replication_package/an_main.R
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Voting and racial attitudes (whites only)
|
| 2 |
+
## Brian T. Hamel and Bryan Wilcox-Archuleta
|
| 3 |
+
## First: 5 May 2019
|
| 4 |
+
## Last: 19 March 2019
|
| 5 |
+
|
| 6 |
+
## Loading packages
|
| 7 |
+
## install.packages(c("estimatr", "tidyverse", "magrittr", "texreg", "gridExtra", "scales"))
|
| 8 |
+
library(estimatr)
|
| 9 |
+
library(tidyverse)
|
| 10 |
+
library(magrittr)
|
| 11 |
+
library(texreg)
|
| 12 |
+
library(gridExtra)
|
| 13 |
+
library(scales)
|
| 14 |
+
|
| 15 |
+
## Loading data
|
| 16 |
+
load("01_data/dta.RData")
|
| 17 |
+
|
| 18 |
+
## Create shell
|
| 19 |
+
shell = dta %>% filter(white == 1) %$%
|
| 20 |
+
expand.grid(racial_flux = seq(min(racial_flux, na.rm = TRUE), max(racial_flux, na.rm = TRUE), by = 1),
|
| 21 |
+
pid7 = round(mean(pid7, na.rm = TRUE), digits = 2),
|
| 22 |
+
ideo5 = round(mean(ideo5, na.rm = TRUE), digits = 2),
|
| 23 |
+
female = round(mean(female, na.rm = TRUE), digits = 2),
|
| 24 |
+
age = round(mean(age, na.rm = TRUE), digits = 2),
|
| 25 |
+
faminc = round(mean(faminc, na.rm = TRUE), digit = 2),
|
| 26 |
+
educ = round(mean(educ, na.rm = TRUE), digits = 2),
|
| 27 |
+
pct_white = round(mean(pct_white, na.rm = TRUE), digits = 2),
|
| 28 |
+
pct_black = round(mean(pct_black, na.rm = TRUE), digits = 2),
|
| 29 |
+
pct_unemployed = round(mean(pct_unemployed, na.rm = TRUE), digits = 2),
|
| 30 |
+
pct_college = round(mean(pct_college, na.rm = TRUE), digits = 2),
|
| 31 |
+
log_per_cap_inc = round(mean(log_per_cap_inc, na.rm = TRUE), digits = 2),
|
| 32 |
+
gini = round(mean(gini, na.rm = TRUE), digits = 2),
|
| 33 |
+
south = round(mean(south, na.rm = TRUE), digits = 2),
|
| 34 |
+
non_rural = round(mean(non_rural, na.rm = TRUE), digits = 2),
|
| 35 |
+
log_pop_density = round(mean(log_pop_density, na.rm = TRUE), digits = 2)) %>%
|
| 36 |
+
na.omit()
|
| 37 |
+
|
| 38 |
+
## Models and predicted probabilities
|
| 39 |
+
pres_dem = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 40 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 41 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 42 |
+
+ log_pop_density, data = dta %>% filter(white == 1),
|
| 43 |
+
clusters = zipcode, se_type = "stata")
|
| 44 |
+
|
| 45 |
+
pred_pres_dem = cbind(predict(pres_dem, shell,
|
| 46 |
+
se.fit = TRUE, type = "response"),
|
| 47 |
+
shell)
|
| 48 |
+
|
| 49 |
+
house_dem = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 50 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 51 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 52 |
+
+ log_pop_density, data = dta %>% filter(white == 1),
|
| 53 |
+
clusters = zipcode, se_type = "stata")
|
| 54 |
+
|
| 55 |
+
pred_house_dem = cbind(predict(house_dem, shell,
|
| 56 |
+
se.fit = TRUE, type = "response"),
|
| 57 |
+
shell)
|
| 58 |
+
|
| 59 |
+
rr = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 60 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 61 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 62 |
+
+ log_pop_density, data = dta %>% filter(white == 1),
|
| 63 |
+
clusters = zipcode, se_type = "stata")
|
| 64 |
+
|
| 65 |
+
pred_rr = cbind(predict(rr, shell,
|
| 66 |
+
se.fit = TRUE, type = "response"),
|
| 67 |
+
shell)
|
| 68 |
+
|
| 69 |
+
affirm = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 70 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 71 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 72 |
+
+ log_pop_density, data = dta %>% filter(white == 1),
|
| 73 |
+
clusters = zipcode, se_type = "stata")
|
| 74 |
+
|
| 75 |
+
pred_affirm = cbind(predict(affirm, shell,
|
| 76 |
+
se.fit = TRUE, type = "response"),
|
| 77 |
+
shell)
|
| 78 |
+
|
| 79 |
+
## Table of coefs., and save
|
| 80 |
+
############################
|
| 81 |
+
## TABLE 1 AND TABLE A3 ###
|
| 82 |
+
############################
|
| 83 |
+
texreg(list(pres_dem, house_dem, rr, affirm),
|
| 84 |
+
file = "03_output/main.tex",
|
| 85 |
+
label = "main",
|
| 86 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites)",
|
| 87 |
+
custom.model.names = c("\\textit{President}", "\\textit{U.S. House}", "\\textit{Racial Resentment}",
|
| 88 |
+
"\\textit{Affirmative Action}"),
|
| 89 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 90 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 91 |
+
"Education", "% White", "% Black",
|
| 92 |
+
"% Unemployed", "% College",
|
| 93 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 94 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 95 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1),
|
| 96 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 97 |
+
stars = c(0.05, 0.01, 0.001),
|
| 98 |
+
digits = 3,
|
| 99 |
+
center = TRUE,
|
| 100 |
+
include.ci = FALSE,
|
| 101 |
+
caption.above = TRUE,
|
| 102 |
+
scalebox = 0.7)
|
| 103 |
+
|
| 104 |
+
## Plot, and save
|
| 105 |
+
pred_pres_dem = cbind(pred_pres_dem, outcome = "President")
|
| 106 |
+
pred_house_dem = cbind(pred_house_dem, outcome = "U.S. House")
|
| 107 |
+
pred_vote = bind_rows(pred_pres_dem, pred_house_dem) %>%
|
| 108 |
+
mutate(upper = fit + 1.96 * se.fit,
|
| 109 |
+
lower = fit - 1.96 * se.fit)
|
| 110 |
+
|
| 111 |
+
vote_plot = ggplot(pred_vote, aes(x = racial_flux, y = fit, ymin = lower, ymax = upper)) +
|
| 112 |
+
geom_line(color = "red4") +
|
| 113 |
+
geom_ribbon(alpha = .2, fill = "red1") +
|
| 114 |
+
facet_wrap(~ outcome, nrow = 1, scales = "free") +
|
| 115 |
+
labs(y = "Pr(Vote Democrat)",
|
| 116 |
+
x = "") +
|
| 117 |
+
geom_rug(data = dta %>% filter(white == 1), aes(x = racial_flux), inherit.aes = FALSE, sides = "b") +
|
| 118 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 119 |
+
theme(legend.title = element_blank(),
|
| 120 |
+
panel.spacing = unit(1, "lines"),
|
| 121 |
+
axis.line.y = element_blank())
|
| 122 |
+
|
| 123 |
+
pred_rr = cbind(pred_rr, outcome = "Racial Resentment")
|
| 124 |
+
pred_affirm = cbind(pred_affirm, outcome = "Affirmative Action")
|
| 125 |
+
pred_att = bind_rows(pred_rr, pred_affirm) %>%
|
| 126 |
+
mutate(upper = fit + 1.96 * se.fit,
|
| 127 |
+
lower = fit - 1.96 * se.fit)
|
| 128 |
+
pred_att$outcome = factor(pred_att$outcome, levels = c("Racial Resentment",
|
| 129 |
+
"Affirmative Action"))
|
| 130 |
+
|
| 131 |
+
##############
|
| 132 |
+
## FIGURE 2 ##
|
| 133 |
+
##############
|
| 134 |
+
att_plot = ggplot(pred_att, aes(x = racial_flux, y = fit, ymin = lower, ymax = upper)) +
|
| 135 |
+
geom_line(color = "red4") +
|
| 136 |
+
geom_ribbon(alpha = .2, fill = "red1") +
|
| 137 |
+
facet_wrap(~ outcome, nrow = 1, scales = "free") +
|
| 138 |
+
labs(y = "Predicted Attitude",
|
| 139 |
+
x = "Racial Flux") +
|
| 140 |
+
geom_rug(data = dta %>% filter(white == 1), aes(x = racial_flux), inherit.aes = FALSE, sides = "b") +
|
| 141 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 142 |
+
theme(legend.title = element_blank(),
|
| 143 |
+
panel.spacing = unit(1, "lines"),
|
| 144 |
+
axis.line.y = element_blank())
|
| 145 |
+
|
| 146 |
+
main = grid.arrange(vote_plot, att_plot, ncol = 1, nrow = 2)
|
| 147 |
+
ggsave(main, file = "03_output/main.png", height = 4, width = 4, units = "in", dpi = 600)
|
| 148 |
+
|
| 149 |
+
## Clear R
|
| 150 |
+
rm(list = ls())
|
4/replication_package/an_non_racial.R
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Non-racial attitudes (whites only)
|
| 2 |
+
## Brian T. Hamel and Bryan Wilcox-Archuleta
|
| 3 |
+
## First: 24 September 2019
|
| 4 |
+
## Last: 19 March 2020
|
| 5 |
+
|
| 6 |
+
## Loading packages
|
| 7 |
+
## install.packages(c("estimatr", "tidyverse", "magrittr", "texreg", "gridExtra", "scales"))
|
| 8 |
+
library(estimatr)
|
| 9 |
+
library(tidyverse)
|
| 10 |
+
library(magrittr)
|
| 11 |
+
library(texreg)
|
| 12 |
+
library(gridExtra)
|
| 13 |
+
library(scales)
|
| 14 |
+
|
| 15 |
+
## Loading data
|
| 16 |
+
load("01_data/dta.RData")
|
| 17 |
+
|
| 18 |
+
## Create shell
|
| 19 |
+
shell = dta %>% filter(white == 1) %$%
|
| 20 |
+
expand.grid(racial_flux = seq(min(racial_flux, na.rm = TRUE), max(racial_flux, na.rm = TRUE), by = 1),
|
| 21 |
+
pid7 = round(mean(pid7, na.rm = TRUE), digits = 2),
|
| 22 |
+
ideo5 = round(mean(ideo5, na.rm = TRUE), digits = 2),
|
| 23 |
+
female = round(mean(female, na.rm = TRUE), digits = 2),
|
| 24 |
+
age = round(mean(age, na.rm = TRUE), digits = 2),
|
| 25 |
+
faminc = round(mean(faminc, na.rm = TRUE), digit = 2),
|
| 26 |
+
educ = round(mean(educ, na.rm = TRUE), digits = 2),
|
| 27 |
+
pct_white = round(mean(pct_white, na.rm = TRUE), digits = 2),
|
| 28 |
+
pct_black = round(mean(pct_black, na.rm = TRUE), digits = 2),
|
| 29 |
+
pct_unemployed = round(mean(pct_unemployed, na.rm = TRUE), digits = 2),
|
| 30 |
+
pct_college = round(mean(pct_college, na.rm = TRUE), digits = 2),
|
| 31 |
+
log_per_cap_inc = round(mean(log_per_cap_inc, na.rm = TRUE), digits = 2),
|
| 32 |
+
gini = round(mean(gini, na.rm = TRUE), digits = 2),
|
| 33 |
+
south = round(mean(south, na.rm = TRUE), digits = 2),
|
| 34 |
+
non_rural = round(mean(non_rural, na.rm = TRUE), digits = 2),
|
| 35 |
+
log_pop_density = round(mean(log_pop_density, na.rm = TRUE), digits = 2)) %>%
|
| 36 |
+
na.omit()
|
| 37 |
+
|
| 38 |
+
## Models and predicted probabilities
|
| 39 |
+
abortion = lm_robust(abortion ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 40 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 41 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 42 |
+
+ log_pop_density, data = dta %>% filter(white == 1),
|
| 43 |
+
clusters = zipcode, se_type = "stata")
|
| 44 |
+
|
| 45 |
+
pred_abortion = cbind(predict(abortion, shell,
|
| 46 |
+
se.fit = TRUE, type = "response"),
|
| 47 |
+
shell)
|
| 48 |
+
|
| 49 |
+
climate = lm_robust(climate ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 50 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 51 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 52 |
+
+ log_pop_density, data = dta %>% filter(white == 1),
|
| 53 |
+
clusters = zipcode, se_type = "stata")
|
| 54 |
+
|
| 55 |
+
pred_climate = cbind(predict(climate, shell,
|
| 56 |
+
se.fit = TRUE, type = "response"),
|
| 57 |
+
shell)
|
| 58 |
+
|
| 59 |
+
guns = lm_robust(guns ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 60 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 61 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 62 |
+
+ log_pop_density, data = dta %>% filter(white == 1),
|
| 63 |
+
clusters = zipcode, se_type = "stata")
|
| 64 |
+
|
| 65 |
+
pred_guns = cbind(predict(guns, shell,
|
| 66 |
+
se.fit = TRUE, type = "response"),
|
| 67 |
+
shell)
|
| 68 |
+
|
| 69 |
+
## Table of coefs., and save
|
| 70 |
+
##############
|
| 71 |
+
## TABLE A5 ##
|
| 72 |
+
##############
|
| 73 |
+
texreg(list(abortion, climate, guns),
|
| 74 |
+
file = "03_output/non_racial.tex",
|
| 75 |
+
label = "non_racial",
|
| 76 |
+
caption = "Racial Flux and Non-Racial Attitudes (Whites)",
|
| 77 |
+
custom.model.names = c("\\textit{Abortion}", "\\textit{Climate Change}",
|
| 78 |
+
"\\textit{Gun Control}"),
|
| 79 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 80 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 81 |
+
"Education", "% White", "% Black",
|
| 82 |
+
"% Unemployed", "% College",
|
| 83 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 84 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 85 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1),
|
| 86 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 87 |
+
stars = c(0.05, 0.01, 0.001),
|
| 88 |
+
digits = 3,
|
| 89 |
+
center = TRUE,
|
| 90 |
+
include.ci = FALSE,
|
| 91 |
+
caption.above = TRUE)
|
| 92 |
+
|
| 93 |
+
## Plot, and save
|
| 94 |
+
pred_abortion = cbind(pred_abortion, outcome = "Abortion")
|
| 95 |
+
pred_climate = cbind(pred_climate, outcome = "Climate Change")
|
| 96 |
+
pred_guns = cbind(pred_guns, outcome = "Gun Control")
|
| 97 |
+
pred_att = bind_rows(pred_abortion, pred_climate, pred_guns) %>%
|
| 98 |
+
mutate(upper = fit + 1.96 * se.fit,
|
| 99 |
+
lower = fit - 1.96 * se.fit)
|
| 100 |
+
|
| 101 |
+
###############
|
| 102 |
+
## FIGURE A1 ##
|
| 103 |
+
###############
|
| 104 |
+
att_plot = ggplot(pred_att, aes(x = racial_flux, y = fit, ymin = lower, ymax = upper)) +
|
| 105 |
+
geom_line(color = "red4") +
|
| 106 |
+
geom_ribbon(alpha = .2, fill = "red1") +
|
| 107 |
+
facet_wrap(~ outcome, nrow = 2, ncol = 2, scales = "free") +
|
| 108 |
+
labs(y = "Predicted Attitude",
|
| 109 |
+
x = "Racial Flux") +
|
| 110 |
+
geom_rug(data = dta %>% filter(white == 1), aes(x = racial_flux), inherit.aes = FALSE, sides = "b") +
|
| 111 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 112 |
+
theme(legend.title = element_blank(),
|
| 113 |
+
panel.spacing = unit(1, "lines"),
|
| 114 |
+
axis.line.y = element_blank()) +
|
| 115 |
+
ggsave(file = "03_output/non_racial.png", height = 4, width = 4, units = "in", dpi = 600)
|
| 116 |
+
|
| 117 |
+
## Clear R
|
| 118 |
+
rm(list = ls())
|
4/replication_package/an_retired.R
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Voting and racial attitudes (retired whites only)
|
| 2 |
+
## Brian T. Hamel and Bryan Wilcox-Archuleta
|
| 3 |
+
## First: 5 May 2019
|
| 4 |
+
## Last: 19 March 2020
|
| 5 |
+
|
| 6 |
+
## Loading packages
|
| 7 |
+
## install.packages(c("estimatr", "tidyverse", "magrittr", "texreg", "gridExtra", "scales"))
|
| 8 |
+
library(estimatr)
|
| 9 |
+
library(tidyverse)
|
| 10 |
+
library(magrittr)
|
| 11 |
+
library(texreg)
|
| 12 |
+
library(gridExtra)
|
| 13 |
+
library(scales)
|
| 14 |
+
|
| 15 |
+
## Loading data
|
| 16 |
+
load("01_data/dta.RData")
|
| 17 |
+
|
| 18 |
+
## Create shell
|
| 19 |
+
shell = dta %>% filter(white == 1 & retired == 1) %$%
|
| 20 |
+
expand.grid(racial_flux = seq(min(racial_flux, na.rm = TRUE), max(racial_flux, na.rm = TRUE), by = 1),
|
| 21 |
+
pid7 = round(mean(pid7, na.rm = TRUE), digits = 2),
|
| 22 |
+
ideo5 = round(mean(ideo5, na.rm = TRUE), digits = 2),
|
| 23 |
+
female = round(mean(female, na.rm = TRUE), digits = 2),
|
| 24 |
+
age = round(mean(age, na.rm = TRUE), digits = 2),
|
| 25 |
+
faminc = round(mean(faminc, na.rm = TRUE), digit = 2),
|
| 26 |
+
educ = round(mean(educ, na.rm = TRUE), digits = 2),
|
| 27 |
+
pct_white = round(mean(pct_white, na.rm = TRUE), digits = 2),
|
| 28 |
+
pct_black = round(mean(pct_black, na.rm = TRUE), digits = 2),
|
| 29 |
+
pct_unemployed = round(mean(pct_unemployed, na.rm = TRUE), digits = 2),
|
| 30 |
+
pct_college = round(mean(pct_college, na.rm = TRUE), digits = 2),
|
| 31 |
+
log_per_cap_inc = round(mean(log_per_cap_inc, na.rm = TRUE), digits = 2),
|
| 32 |
+
gini = round(mean(gini, na.rm = TRUE), digits = 2),
|
| 33 |
+
south = round(mean(south, na.rm = TRUE), digits = 2),
|
| 34 |
+
non_rural = round(mean(non_rural, na.rm = TRUE), digits = 2),
|
| 35 |
+
log_pop_density = round(mean(log_pop_density, na.rm = TRUE), digits = 2)) %>%
|
| 36 |
+
na.omit()
|
| 37 |
+
|
| 38 |
+
## Models and predicted probabilities
|
| 39 |
+
pres_dem = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 40 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 41 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 42 |
+
+ log_pop_density, data = dta %>% filter(white == 1 & retired == 1),
|
| 43 |
+
clusters = zipcode, se_type = "stata")
|
| 44 |
+
|
| 45 |
+
pred_pres_dem = cbind(predict(pres_dem, shell,
|
| 46 |
+
se.fit = TRUE, type = "response"),
|
| 47 |
+
shell)
|
| 48 |
+
|
| 49 |
+
house_dem = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 50 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 51 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 52 |
+
+ log_pop_density, data = dta %>% filter(white == 1 & retired == 1),
|
| 53 |
+
clusters = zipcode, se_type = "stata")
|
| 54 |
+
|
| 55 |
+
pred_house_dem = cbind(predict(house_dem, shell,
|
| 56 |
+
se.fit = TRUE, type = "response"),
|
| 57 |
+
shell)
|
| 58 |
+
|
| 59 |
+
rr = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 60 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 61 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 62 |
+
+ log_pop_density, data = dta %>% filter(white == 1 & retired == 1),
|
| 63 |
+
clusters = zipcode, se_type = "stata")
|
| 64 |
+
|
| 65 |
+
pred_rr = cbind(predict(rr, shell,
|
| 66 |
+
se.fit = TRUE, type = "response"),
|
| 67 |
+
shell)
|
| 68 |
+
|
| 69 |
+
affirm = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 70 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 71 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 72 |
+
+ log_pop_density, data = dta %>% filter(white == 1 & retired == 1),
|
| 73 |
+
clusters = zipcode, se_type = "stata")
|
| 74 |
+
|
| 75 |
+
pred_affirm = cbind(predict(affirm, shell,
|
| 76 |
+
se.fit = TRUE, type = "response"),
|
| 77 |
+
shell)
|
| 78 |
+
|
| 79 |
+
## Table of coefs., and save
|
| 80 |
+
##############
|
| 81 |
+
## TABLE A7 ##
|
| 82 |
+
##############
|
| 83 |
+
texreg(list(pres_dem, house_dem, rr, affirm),
|
| 84 |
+
file = "03_output/retired.tex",
|
| 85 |
+
label = "retired",
|
| 86 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Retired Whites)",
|
| 87 |
+
custom.model.names = c("\\textit{President}", "\\textit{U.S. House}", "\\textit{Racial Resentment}",
|
| 88 |
+
"\\textit{Affirmative Action}"),
|
| 89 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 90 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 91 |
+
"Education", "% White", "% Black",
|
| 92 |
+
"% Unemployed", "% College",
|
| 93 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 94 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 95 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1),
|
| 96 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 97 |
+
stars = c(0.05, 0.01, 0.001),
|
| 98 |
+
digits = 3,
|
| 99 |
+
center = TRUE,
|
| 100 |
+
include.ci = FALSE,
|
| 101 |
+
caption.above = TRUE,
|
| 102 |
+
scalebox = 0.7)
|
| 103 |
+
|
| 104 |
+
## Plot, and save
|
| 105 |
+
pred_pres_dem = cbind(pred_pres_dem, outcome = "President")
|
| 106 |
+
pred_house_dem = cbind(pred_house_dem, outcome = "U.S. House")
|
| 107 |
+
pred_vote = bind_rows(pred_pres_dem, pred_house_dem) %>%
|
| 108 |
+
mutate(upper = fit + 1.96 * se.fit,
|
| 109 |
+
lower = fit - 1.96 * se.fit)
|
| 110 |
+
|
| 111 |
+
vote_plot = ggplot(pred_vote, aes(x = racial_flux, y = fit, ymin = lower, ymax = upper)) +
|
| 112 |
+
geom_line(color = "red4") +
|
| 113 |
+
geom_ribbon(alpha = .2, fill = "red1") +
|
| 114 |
+
facet_wrap(~ outcome, nrow = 1, scales = "free") +
|
| 115 |
+
labs(y = "Pr(Vote Democrat)",
|
| 116 |
+
x = "") +
|
| 117 |
+
geom_rug(data = dta %>% filter(white == 1 & retired == 1),
|
| 118 |
+
aes(x = racial_flux), inherit.aes = FALSE, sides = "b") +
|
| 119 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 120 |
+
theme(legend.title = element_blank(),
|
| 121 |
+
panel.spacing = unit(1, "lines"),
|
| 122 |
+
axis.line.y = element_blank())
|
| 123 |
+
|
| 124 |
+
pred_rr = cbind(pred_rr, outcome = "Racial Resentment")
|
| 125 |
+
pred_affirm = cbind(pred_affirm, outcome = "Affirmative Action")
|
| 126 |
+
pred_att = bind_rows(pred_rr, pred_affirm) %>%
|
| 127 |
+
mutate(upper = fit + 1.96 * se.fit,
|
| 128 |
+
lower = fit - 1.96 * se.fit)
|
| 129 |
+
pred_att$outcome = factor(pred_att$outcome, levels = c("Racial Resentment",
|
| 130 |
+
"Affirmative Action"))
|
| 131 |
+
|
| 132 |
+
###############
|
| 133 |
+
## FIGURE A3 ##
|
| 134 |
+
###############
|
| 135 |
+
att_plot = ggplot(pred_att, aes(x = racial_flux, y = fit, ymin = lower, ymax = upper)) +
|
| 136 |
+
geom_line(color = "red4") +
|
| 137 |
+
geom_ribbon(alpha = .2, fill = "red1") +
|
| 138 |
+
facet_wrap(~ outcome, nrow = 1, scales = "free") +
|
| 139 |
+
labs(y = "Predicted Attitude",
|
| 140 |
+
x = "Racial Flux") +
|
| 141 |
+
geom_rug(data = dta %>% filter(white == 1 & retired == 1),
|
| 142 |
+
aes(x = racial_flux), inherit.aes = FALSE, sides = "b") +
|
| 143 |
+
scale_y_continuous(labels = number_format(accuracy = 0.01)) +
|
| 144 |
+
theme(legend.title = element_blank(),
|
| 145 |
+
panel.spacing = unit(1, "lines"),
|
| 146 |
+
axis.line.y = element_blank())
|
| 147 |
+
|
| 148 |
+
main = grid.arrange(vote_plot, att_plot, ncol = 1, nrow = 2)
|
| 149 |
+
ggsave(main, file = "03_output/retired.png", height = 4, width = 4, units = "in", dpi = 600)
|
| 150 |
+
|
| 151 |
+
## Clear R
|
| 152 |
+
rm(list = ls())
|
4/replication_package/an_robust.R
ADDED
|
@@ -0,0 +1,650 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Voting and racial attitudes (whites only) -- robustness checks for JOP
|
| 2 |
+
## Brian T. Hamel and Bryan Wilcox-Archuleta
|
| 3 |
+
## First: 11 March 2020
|
| 4 |
+
## Last: 16 March 2020
|
| 5 |
+
|
| 6 |
+
## Loading packages
|
| 7 |
+
## install.packages(c("estimatr", "tidyverse", "magrittr", "texreg", "gridExtra", "scales"))
|
| 8 |
+
library(estimatr)
|
| 9 |
+
library(tidyverse)
|
| 10 |
+
library(magrittr)
|
| 11 |
+
library(texreg)
|
| 12 |
+
library(gridExtra)
|
| 13 |
+
library(scales)
|
| 14 |
+
library(lme4)
|
| 15 |
+
|
| 16 |
+
## Loading data
|
| 17 |
+
load("01_data/dta.RData")
|
| 18 |
+
|
| 19 |
+
## Number of people per zipcode
|
| 20 |
+
people_per_zip = dta %>%
|
| 21 |
+
group_by(zipcode) %>%
|
| 22 |
+
mutate(n = 1) %>%
|
| 23 |
+
summarise(tot_people = sum(n, na.rm = TRUE))
|
| 24 |
+
|
| 25 |
+
mean(people_per_zip$tot_people)
|
| 26 |
+
sd(people_per_zip$tot_people)
|
| 27 |
+
|
| 28 |
+
people_per_zip %>%
|
| 29 |
+
filter(tot_people >= 30)
|
| 30 |
+
|
| 31 |
+
## Re-estimating the main models with random slope and intercept
|
| 32 |
+
pres_dem = lmer(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 33 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 34 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 35 |
+
+ log_pop_density + (1 | zipcode),
|
| 36 |
+
data = dta %>% filter(white == 1))
|
| 37 |
+
|
| 38 |
+
house_dem = lmer(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 39 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 40 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 41 |
+
+ log_pop_density + (1 | zipcode),
|
| 42 |
+
data = dta %>% filter(white == 1))
|
| 43 |
+
|
| 44 |
+
rr = lmer(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 45 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 46 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 47 |
+
+ log_pop_density + (1 | zipcode),
|
| 48 |
+
data = dta %>% filter(white == 1))
|
| 49 |
+
|
| 50 |
+
affirm = lmer(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 51 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 52 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 53 |
+
+ log_pop_density + (1 | zipcode),
|
| 54 |
+
data = dta %>% filter(white == 1))
|
| 55 |
+
|
| 56 |
+
## Table of coefs., and save
|
| 57 |
+
##############
|
| 58 |
+
## TABLE A4 ##
|
| 59 |
+
##############
|
| 60 |
+
texreg(list(pres_dem, house_dem, rr, affirm),
|
| 61 |
+
file = "03_output/mlm.tex",
|
| 62 |
+
label = "mlm",
|
| 63 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- Models with Random Intercept for Zip Code",
|
| 64 |
+
custom.model.names = c("\\textit{President}", "\\textit{U.S. House}", "\\textit{Racial Resentment}",
|
| 65 |
+
"\\textit{Affirmative Action}"),
|
| 66 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 67 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 68 |
+
"Education", "% White", "% Black",
|
| 69 |
+
"% Unemployed", "% College",
|
| 70 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 71 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 72 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1),
|
| 73 |
+
include.loglik = FALSE,
|
| 74 |
+
custom.gof.names = c(NA, NA, "\\# of Individuals", "\\# of Zip Codes", NA, NA),
|
| 75 |
+
stars = c(0.05, 0.01, 0.001),
|
| 76 |
+
digits = 3,
|
| 77 |
+
center = TRUE,
|
| 78 |
+
include.ci = FALSE,
|
| 79 |
+
caption.above = TRUE,
|
| 80 |
+
scalebox = 0.9)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
## Adding past racial segregation -- 90
|
| 84 |
+
pres_dem_zseg90 = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 85 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 86 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 87 |
+
+ log_pop_density + zipcode_dissim_90,
|
| 88 |
+
data = dta %>% filter(white == 1),
|
| 89 |
+
clusters = zipcode, se_type = "stata")
|
| 90 |
+
|
| 91 |
+
pres_dem_cseg90 = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 92 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 93 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 94 |
+
+ log_pop_density + county_dissim_90,
|
| 95 |
+
data = dta %>% filter(white == 1),
|
| 96 |
+
clusters = zipcode, se_type = "stata")
|
| 97 |
+
|
| 98 |
+
house_dem_zseg90 = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 99 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 100 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 101 |
+
+ log_pop_density + zipcode_dissim_90,
|
| 102 |
+
data = dta %>% filter(white == 1),
|
| 103 |
+
clusters = zipcode, se_type = "stata")
|
| 104 |
+
|
| 105 |
+
house_dem_cseg90 = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 106 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 107 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 108 |
+
+ log_pop_density + county_dissim_90,
|
| 109 |
+
data = dta %>% filter(white == 1),
|
| 110 |
+
clusters = zipcode, se_type = "stata")
|
| 111 |
+
|
| 112 |
+
rr_zseg90 = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 113 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 114 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 115 |
+
+ log_pop_density + zipcode_dissim_90,
|
| 116 |
+
data = dta %>% filter(white == 1),
|
| 117 |
+
clusters = zipcode, se_type = "stata")
|
| 118 |
+
|
| 119 |
+
rr_cseg90 = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 120 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 121 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 122 |
+
+ log_pop_density + county_dissim_90,
|
| 123 |
+
data = dta %>% filter(white == 1),
|
| 124 |
+
clusters = zipcode, se_type = "stata")
|
| 125 |
+
|
| 126 |
+
affirm_zseg90 = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 127 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 128 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 129 |
+
+ log_pop_density + zipcode_dissim_90,
|
| 130 |
+
data = dta %>% filter(white == 1),
|
| 131 |
+
clusters = zipcode, se_type = "stata")
|
| 132 |
+
|
| 133 |
+
affirm_cseg90 = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 134 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 135 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 136 |
+
+ log_pop_density + county_dissim_90,
|
| 137 |
+
data = dta %>% filter(white == 1),
|
| 138 |
+
clusters = zipcode, se_type = "stata")
|
| 139 |
+
|
| 140 |
+
## Table of coefs., and save
|
| 141 |
+
##############
|
| 142 |
+
## TABLE A8 ##
|
| 143 |
+
##############
|
| 144 |
+
texreg(list(pres_dem_zseg90, pres_dem_cseg90,
|
| 145 |
+
house_dem_zseg90, house_dem_cseg90,
|
| 146 |
+
rr_zseg90, rr_cseg90,
|
| 147 |
+
affirm_zseg90, affirm_cseg90),
|
| 148 |
+
file = "03_output/seg90.tex",
|
| 149 |
+
label = "seg90",
|
| 150 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- Controlling for Racial Segregation in 1990",
|
| 151 |
+
custom.model.names = c("\\textit{President}", "\\textit{President}",
|
| 152 |
+
"\\textit{U.S. House}", "\\textit{U.S. House}",
|
| 153 |
+
"\\textit{Racial Resentment}", "\\textit{Racial Resentment}",
|
| 154 |
+
"\\textit{Affirmative Action}", "\\textit{Affirmative Action}"),
|
| 155 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 156 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 157 |
+
"Education", "% White", "% Black",
|
| 158 |
+
"% Unemployed", "% College",
|
| 159 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 160 |
+
"Non-Rural", "log(Pop. Density)",
|
| 161 |
+
"Zipcode Dissimilarity", "County Dissimilarity"),
|
| 162 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1),
|
| 163 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 164 |
+
stars = c(0.05, 0.01, 0.001),
|
| 165 |
+
digits = 3,
|
| 166 |
+
center = TRUE,
|
| 167 |
+
include.ci = FALSE,
|
| 168 |
+
caption.above = TRUE,
|
| 169 |
+
scalebox = 0.7)
|
| 170 |
+
|
| 171 |
+
## Adding past racial segregation -- 00
|
| 172 |
+
pres_dem_zseg00 = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 173 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 174 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 175 |
+
+ log_pop_density + zipcode_dissim_00,
|
| 176 |
+
data = dta %>% filter(white == 1),
|
| 177 |
+
clusters = zipcode, se_type = "stata")
|
| 178 |
+
|
| 179 |
+
pres_dem_cseg00 = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 180 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 181 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 182 |
+
+ log_pop_density + county_dissim_00,
|
| 183 |
+
data = dta %>% filter(white == 1),
|
| 184 |
+
clusters = zipcode, se_type = "stata")
|
| 185 |
+
|
| 186 |
+
house_dem_zseg00 = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 187 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 188 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 189 |
+
+ log_pop_density + zipcode_dissim_00,
|
| 190 |
+
data = dta %>% filter(white == 1),
|
| 191 |
+
clusters = zipcode, se_type = "stata")
|
| 192 |
+
|
| 193 |
+
house_dem_cseg00 = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 194 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 195 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 196 |
+
+ log_pop_density + county_dissim_00,
|
| 197 |
+
data = dta %>% filter(white == 1),
|
| 198 |
+
clusters = zipcode, se_type = "stata")
|
| 199 |
+
|
| 200 |
+
rr_zseg00 = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 201 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 202 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 203 |
+
+ log_pop_density + zipcode_dissim_00,
|
| 204 |
+
data = dta %>% filter(white == 1),
|
| 205 |
+
clusters = zipcode, se_type = "stata")
|
| 206 |
+
|
| 207 |
+
rr_cseg00 = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 208 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 209 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 210 |
+
+ log_pop_density + county_dissim_00,
|
| 211 |
+
data = dta %>% filter(white == 1),
|
| 212 |
+
clusters = zipcode, se_type = "stata")
|
| 213 |
+
|
| 214 |
+
affirm_zseg00 = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 215 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 216 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 217 |
+
+ log_pop_density + zipcode_dissim_00,
|
| 218 |
+
data = dta %>% filter(white == 1),
|
| 219 |
+
clusters = zipcode, se_type = "stata")
|
| 220 |
+
|
| 221 |
+
affirm_cseg00 = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 222 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 223 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 224 |
+
+ log_pop_density + county_dissim_00,
|
| 225 |
+
data = dta %>% filter(white == 1),
|
| 226 |
+
clusters = zipcode, se_type = "stata")
|
| 227 |
+
|
| 228 |
+
## Table of coefs., and save
|
| 229 |
+
##############
|
| 230 |
+
## TABLE A9 ##
|
| 231 |
+
##############
|
| 232 |
+
texreg(list(pres_dem_zseg00, pres_dem_cseg00,
|
| 233 |
+
house_dem_zseg00, house_dem_cseg00,
|
| 234 |
+
rr_zseg00, rr_cseg00,
|
| 235 |
+
affirm_zseg00, affirm_cseg00),
|
| 236 |
+
file = "03_output/seg00.tex",
|
| 237 |
+
label = "seg00",
|
| 238 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- Controlling for Racial Segregation in 2000",
|
| 239 |
+
custom.model.names = c("\\textit{President}", "\\textit{President}",
|
| 240 |
+
"\\textit{U.S. House}", "\\textit{U.S. House}",
|
| 241 |
+
"\\textit{Racial Resentment}", "\\textit{Racial Resentment}",
|
| 242 |
+
"\\textit{Affirmative Action}", "\\textit{Affirmative Action}"),
|
| 243 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 244 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 245 |
+
"Education", "% White", "% Black",
|
| 246 |
+
"% Unemployed", "% College",
|
| 247 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 248 |
+
"Non-Rural", "log(Pop. Density)",
|
| 249 |
+
"Zipcode Dissimilarity", "County Dissimilarity"),
|
| 250 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1),
|
| 251 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 252 |
+
stars = c(0.05, 0.01, 0.001),
|
| 253 |
+
digits = 3,
|
| 254 |
+
center = TRUE,
|
| 255 |
+
include.ci = FALSE,
|
| 256 |
+
caption.above = TRUE,
|
| 257 |
+
scalebox = 0.7)
|
| 258 |
+
|
| 259 |
+
## Adding past racial conflict
|
| 260 |
+
pres_dem_conflict = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 261 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 262 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 263 |
+
+ log_pop_density + goldwater + protest,
|
| 264 |
+
data = dta %>% filter(white == 1),
|
| 265 |
+
clusters = zipcode, se_type = "stata")
|
| 266 |
+
|
| 267 |
+
house_dem_conflict = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 268 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 269 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 270 |
+
+ log_pop_density + goldwater + protest,
|
| 271 |
+
data = dta %>% filter(white == 1),
|
| 272 |
+
clusters = zipcode, se_type = "stata")
|
| 273 |
+
|
| 274 |
+
rr_conflict = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 275 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 276 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 277 |
+
+ log_pop_density + goldwater + protest,
|
| 278 |
+
data = dta %>% filter(white == 1),
|
| 279 |
+
clusters = zipcode, se_type = "stata")
|
| 280 |
+
|
| 281 |
+
affirm_conflict = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 282 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 283 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 284 |
+
+ log_pop_density + goldwater + protest,
|
| 285 |
+
data = dta %>% filter(white == 1),
|
| 286 |
+
clusters = zipcode, se_type = "stata")
|
| 287 |
+
|
| 288 |
+
## Table of coefs., and save
|
| 289 |
+
##############
|
| 290 |
+
## TABLE A10 ##
|
| 291 |
+
##############
|
| 292 |
+
texreg(list(pres_dem_conflict, house_dem_conflict, rr_conflict, affirm_conflict),
|
| 293 |
+
file = "03_output/conflict.tex",
|
| 294 |
+
label = "conflict",
|
| 295 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- Controlling for Past Racial and Political Conflict",
|
| 296 |
+
custom.model.names = c("\\textit{President}", "\\textit{U.S. House}", "\\textit{Racial Resentment}",
|
| 297 |
+
"\\textit{Affirmative Action}"),
|
| 298 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 299 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 300 |
+
"Education", "% White", "% Black",
|
| 301 |
+
"% Unemployed", "% College",
|
| 302 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 303 |
+
"Non-Rural", "log(Pop. Density)",
|
| 304 |
+
"Support for Goldwater", "Civil Rights Protest"),
|
| 305 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1),
|
| 306 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 307 |
+
stars = c(0.05, 0.01, 0.001),
|
| 308 |
+
digits = 3,
|
| 309 |
+
center = TRUE,
|
| 310 |
+
include.ci = FALSE,
|
| 311 |
+
caption.above = TRUE,
|
| 312 |
+
scalebox = 0.7)
|
| 313 |
+
|
| 314 |
+
## Adding past racial income gap -- 90
|
| 315 |
+
pres_dem_zinc90 = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 316 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 317 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 318 |
+
+ log_pop_density + zipcode_inc_gap_90,
|
| 319 |
+
data = dta %>% filter(white == 1),
|
| 320 |
+
clusters = zipcode, se_type = "stata")
|
| 321 |
+
|
| 322 |
+
pres_dem_cinc90 = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 323 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 324 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 325 |
+
+ log_pop_density + county_inc_gap_90,
|
| 326 |
+
data = dta %>% filter(white == 1),
|
| 327 |
+
clusters = zipcode, se_type = "stata")
|
| 328 |
+
|
| 329 |
+
house_dem_zinc90 = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 330 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 331 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 332 |
+
+ log_pop_density + zipcode_inc_gap_90,
|
| 333 |
+
data = dta %>% filter(white == 1),
|
| 334 |
+
clusters = zipcode, se_type = "stata")
|
| 335 |
+
|
| 336 |
+
house_dem_cinc90 = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 337 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 338 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 339 |
+
+ log_pop_density + county_inc_gap_90,
|
| 340 |
+
data = dta %>% filter(white == 1),
|
| 341 |
+
clusters = zipcode, se_type = "stata")
|
| 342 |
+
|
| 343 |
+
rr_zinc90 = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 344 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 345 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 346 |
+
+ log_pop_density + zipcode_inc_gap_90,
|
| 347 |
+
data = dta %>% filter(white == 1),
|
| 348 |
+
clusters = zipcode, se_type = "stata")
|
| 349 |
+
|
| 350 |
+
rr_cinc90 = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 351 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 352 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 353 |
+
+ log_pop_density + county_inc_gap_90,
|
| 354 |
+
data = dta %>% filter(white == 1),
|
| 355 |
+
clusters = zipcode, se_type = "stata")
|
| 356 |
+
|
| 357 |
+
affirm_zinc90 = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 358 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 359 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 360 |
+
+ log_pop_density + zipcode_inc_gap_90,
|
| 361 |
+
data = dta %>% filter(white == 1),
|
| 362 |
+
clusters = zipcode, se_type = "stata")
|
| 363 |
+
|
| 364 |
+
affirm_cinc90 = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 365 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 366 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 367 |
+
+ log_pop_density + county_inc_gap_90,
|
| 368 |
+
data = dta %>% filter(white == 1),
|
| 369 |
+
clusters = zipcode, se_type = "stata")
|
| 370 |
+
|
| 371 |
+
## Table of coefs., and save
|
| 372 |
+
###############
|
| 373 |
+
## TABLE A11 ##
|
| 374 |
+
###############
|
| 375 |
+
texreg(list(pres_dem_zinc90, pres_dem_cinc90,
|
| 376 |
+
house_dem_zinc90, house_dem_cinc90,
|
| 377 |
+
rr_zinc90, rr_cinc90,
|
| 378 |
+
affirm_zinc90, affirm_cinc90),
|
| 379 |
+
file = "03_output/inc90.tex",
|
| 380 |
+
label = "inc90",
|
| 381 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- Controlling for the Racial Income Gap in 1990",
|
| 382 |
+
custom.model.names = c("\\textit{President}", "\\textit{President}",
|
| 383 |
+
"\\textit{U.S. House}", "\\textit{U.S. House}",
|
| 384 |
+
"\\textit{Racial Resentment}", "\\textit{Racial Resentment}",
|
| 385 |
+
"\\textit{Affirmative Action}", "\\textit{Affirmative Action}"),
|
| 386 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 387 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 388 |
+
"Education", "% White", "% Black",
|
| 389 |
+
"% Unemployed", "% College",
|
| 390 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 391 |
+
"Non-Rural", "log(Pop. Density)",
|
| 392 |
+
"Zipcode White-Black Income Gap", "County White-Black Income Gap"),
|
| 393 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1),
|
| 394 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 395 |
+
stars = c(0.05, 0.01, 0.001),
|
| 396 |
+
digits = 3,
|
| 397 |
+
center = TRUE,
|
| 398 |
+
include.ci = FALSE,
|
| 399 |
+
caption.above = TRUE,
|
| 400 |
+
scalebox = 0.7)
|
| 401 |
+
|
| 402 |
+
## Adding past racial income gap -- 00
|
| 403 |
+
pres_dem_zinc00 = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 404 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 405 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 406 |
+
+ log_pop_density + zipcode_inc_gap_00,
|
| 407 |
+
data = dta %>% filter(white == 1),
|
| 408 |
+
clusters = zipcode, se_type = "stata")
|
| 409 |
+
|
| 410 |
+
pres_dem_cinc00 = lm_robust(pres_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 411 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 412 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 413 |
+
+ log_pop_density + county_inc_gap_00,
|
| 414 |
+
data = dta %>% filter(white == 1),
|
| 415 |
+
clusters = zipcode, se_type = "stata")
|
| 416 |
+
|
| 417 |
+
house_dem_zinc00 = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 418 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 419 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 420 |
+
+ log_pop_density + zipcode_inc_gap_00,
|
| 421 |
+
data = dta %>% filter(white == 1),
|
| 422 |
+
clusters = zipcode, se_type = "stata")
|
| 423 |
+
|
| 424 |
+
house_dem_cinc00 = lm_robust(house_dem ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 425 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 426 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 427 |
+
+ log_pop_density + county_inc_gap_00,
|
| 428 |
+
data = dta %>% filter(white == 1),
|
| 429 |
+
clusters = zipcode, se_type = "stata")
|
| 430 |
+
|
| 431 |
+
rr_zinc00 = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 432 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 433 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 434 |
+
+ log_pop_density + zipcode_inc_gap_00,
|
| 435 |
+
data = dta %>% filter(white == 1),
|
| 436 |
+
clusters = zipcode, se_type = "stata")
|
| 437 |
+
|
| 438 |
+
rr_cinc00 = lm_robust(mean_rr ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 439 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 440 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 441 |
+
+ log_pop_density + county_inc_gap_00,
|
| 442 |
+
data = dta %>% filter(white == 1),
|
| 443 |
+
clusters = zipcode, se_type = "stata")
|
| 444 |
+
|
| 445 |
+
affirm_zinc00 = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 446 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 447 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 448 |
+
+ log_pop_density + zipcode_inc_gap_00,
|
| 449 |
+
data = dta %>% filter(white == 1),
|
| 450 |
+
clusters = zipcode, se_type = "stata")
|
| 451 |
+
|
| 452 |
+
affirm_cinc00 = lm_robust(affirm ~ racial_flux + pid7 + ideo5 + female + age + faminc
|
| 453 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 454 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 455 |
+
+ log_pop_density + county_inc_gap_00,
|
| 456 |
+
data = dta %>% filter(white == 1),
|
| 457 |
+
clusters = zipcode, se_type = "stata")
|
| 458 |
+
|
| 459 |
+
## Table of coefs., and save
|
| 460 |
+
###############
|
| 461 |
+
## TABLE A12 ##
|
| 462 |
+
###############
|
| 463 |
+
texreg(list(pres_dem_zinc00, pres_dem_cinc00,
|
| 464 |
+
house_dem_zinc00, house_dem_cinc00,
|
| 465 |
+
rr_zinc00, rr_cinc00,
|
| 466 |
+
affirm_zinc00, affirm_cinc00),
|
| 467 |
+
file = "03_output/inc00.tex",
|
| 468 |
+
label = "inc00",
|
| 469 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- Controlling for the Racial Income Gap in 2000",
|
| 470 |
+
custom.model.names = c("\\textit{President}", "\\textit{President}",
|
| 471 |
+
"\\textit{U.S. House}", "\\textit{U.S. House}",
|
| 472 |
+
"\\textit{Racial Resentment}", "\\textit{Racial Resentment}",
|
| 473 |
+
"\\textit{Affirmative Action}", "\\textit{Affirmative Action}"),
|
| 474 |
+
custom.coef.names = c("Intercept", "Racial Flux", "Party ID",
|
| 475 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 476 |
+
"Education", "% White", "% Black",
|
| 477 |
+
"% Unemployed", "% College",
|
| 478 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 479 |
+
"Non-Rural", "log(Pop. Density)",
|
| 480 |
+
"Zipcode White-Black Income Gap", "County White-Black Income Gap"),
|
| 481 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1),
|
| 482 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 483 |
+
stars = c(0.05, 0.01, 0.001),
|
| 484 |
+
digits = 3,
|
| 485 |
+
center = TRUE,
|
| 486 |
+
include.ci = FALSE,
|
| 487 |
+
caption.above = TRUE,
|
| 488 |
+
scalebox = 0.7)
|
| 489 |
+
|
| 490 |
+
## Subsetting to above median % white
|
| 491 |
+
pres_dem_median = lm_robust(pres_dem ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 492 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 493 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 494 |
+
+ log_pop_density,
|
| 495 |
+
data = dta %>% filter(white == 1 & pct_white >= median(dta$pct_white, na.rm = TRUE)),
|
| 496 |
+
clusters = zipcode, se_type = "stata")
|
| 497 |
+
|
| 498 |
+
house_dem_median = lm_robust(house_dem ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 499 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 500 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 501 |
+
+ log_pop_density,
|
| 502 |
+
data = dta %>% filter(white == 1 & pct_white >= median(dta$pct_white, na.rm = TRUE)),
|
| 503 |
+
clusters = zipcode, se_type = "stata")
|
| 504 |
+
|
| 505 |
+
rr_median = lm_robust(mean_rr ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 506 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 507 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 508 |
+
+ log_pop_density,
|
| 509 |
+
data = dta %>% filter(white == 1 & pct_white >= median(dta$pct_white, na.rm = TRUE)),
|
| 510 |
+
clusters = zipcode, se_type = "stata")
|
| 511 |
+
|
| 512 |
+
affirm_median = lm_robust(affirm ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 513 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 514 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 515 |
+
+ log_pop_density,
|
| 516 |
+
data = dta %>% filter(white == 1 & pct_white >= median(dta$pct_white, na.rm = TRUE)),
|
| 517 |
+
clusters = zipcode, se_type = "stata")
|
| 518 |
+
|
| 519 |
+
## Table of coefs., and save
|
| 520 |
+
###############
|
| 521 |
+
## TABLE A13 ##
|
| 522 |
+
###############
|
| 523 |
+
texreg(list(pres_dem_median, house_dem_median, rr_median, affirm_median),
|
| 524 |
+
file = "03_output/median.tex",
|
| 525 |
+
label = "median",
|
| 526 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- % White > Median",
|
| 527 |
+
custom.model.names = c("\\textit{President}", "\\textit{U.S. House}", "\\textit{Racial Resentment}",
|
| 528 |
+
"\\textit{Affirmative Action}"),
|
| 529 |
+
custom.coef.names = c("Intercept", "% Black Workers", "Party ID",
|
| 530 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 531 |
+
"Education", "% White", "% Black",
|
| 532 |
+
"% Unemployed", "% College",
|
| 533 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 534 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 535 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1),
|
| 536 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 537 |
+
stars = c(0.05, 0.01, 0.001),
|
| 538 |
+
digits = 3,
|
| 539 |
+
center = TRUE,
|
| 540 |
+
include.ci = FALSE,
|
| 541 |
+
caption.above = TRUE,
|
| 542 |
+
scalebox = 0.7)
|
| 543 |
+
|
| 544 |
+
## Subsetting to above 75th percentile % white
|
| 545 |
+
pres_dem_75 = lm_robust(pres_dem ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 546 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 547 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 548 |
+
+ log_pop_density,
|
| 549 |
+
data = dta %>% filter(white == 1 & pct_white >= quantile(dta$pct_white, 0.75, na.rm = TRUE)),
|
| 550 |
+
clusters = zipcode, se_type = "stata")
|
| 551 |
+
|
| 552 |
+
house_dem_75 = lm_robust(house_dem ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 553 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 554 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 555 |
+
+ log_pop_density,
|
| 556 |
+
data = dta %>% filter(white == 1 & pct_white >= quantile(dta$pct_white, 0.75, na.rm = TRUE)),
|
| 557 |
+
clusters = zipcode, se_type = "stata")
|
| 558 |
+
|
| 559 |
+
rr_75 = lm_robust(mean_rr ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 560 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 561 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 562 |
+
+ log_pop_density,
|
| 563 |
+
data = dta %>% filter(white == 1 & pct_white >= quantile(dta$pct_white, 0.75, na.rm = TRUE)),
|
| 564 |
+
clusters = zipcode, se_type = "stata")
|
| 565 |
+
|
| 566 |
+
affirm_75 = lm_robust(affirm ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 567 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 568 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 569 |
+
+ log_pop_density,
|
| 570 |
+
data = dta %>% filter(white == 1 & pct_white >= quantile(dta$pct_white, 0.75, na.rm = TRUE)),
|
| 571 |
+
clusters = zipcode, se_type = "stata")
|
| 572 |
+
|
| 573 |
+
## Table of coefs., and save
|
| 574 |
+
###############
|
| 575 |
+
## TABLE A14 ##
|
| 576 |
+
###############
|
| 577 |
+
texreg(list(pres_dem_75, house_dem_75, rr_75, affirm_75),
|
| 578 |
+
file = "03_output/p75.tex",
|
| 579 |
+
label = "p75",
|
| 580 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- % White > 75th Percentile",
|
| 581 |
+
custom.model.names = c("\\textit{President}", "\\textit{U.S. House}", "\\textit{Racial Resentment}",
|
| 582 |
+
"\\textit{Affirmative Action}"),
|
| 583 |
+
custom.coef.names = c("Intercept", "% Black Workers", "Party ID",
|
| 584 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 585 |
+
"Education", "% White", "% Black",
|
| 586 |
+
"% Unemployed", "% College",
|
| 587 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 588 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 589 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1),
|
| 590 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 591 |
+
stars = c(0.05, 0.01, 0.001),
|
| 592 |
+
digits = 3,
|
| 593 |
+
center = TRUE,
|
| 594 |
+
include.ci = FALSE,
|
| 595 |
+
caption.above = TRUE,
|
| 596 |
+
scalebox = 0.7)
|
| 597 |
+
|
| 598 |
+
## Subsetting to above 90th percentile % white
|
| 599 |
+
pres_dem_90 = lm_robust(pres_dem ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 600 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 601 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 602 |
+
+ log_pop_density,
|
| 603 |
+
data = dta %>% filter(white == 1 & pct_white >= quantile(dta$pct_white, 0.9, na.rm = TRUE)),
|
| 604 |
+
clusters = zipcode, se_type = "stata")
|
| 605 |
+
|
| 606 |
+
house_dem_90 = lm_robust(pres_dem ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 607 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 608 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 609 |
+
+ log_pop_density,
|
| 610 |
+
data = dta %>% filter(white == 1 & pct_white >= quantile(dta$pct_white, 0.9, na.rm = TRUE)),
|
| 611 |
+
clusters = zipcode, se_type = "stata")
|
| 612 |
+
|
| 613 |
+
rr_90 = lm_robust(mean_rr ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 614 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 615 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 616 |
+
+ log_pop_density,
|
| 617 |
+
data = dta %>% filter(white == 1 & pct_white >= quantile(dta$pct_white, 0.9, na.rm = TRUE)),
|
| 618 |
+
clusters = zipcode, se_type = "stata")
|
| 619 |
+
|
| 620 |
+
affirm_90 = lm_robust(affirm ~ wac_pct_black + pid7 + ideo5 + female + age + faminc
|
| 621 |
+
+ educ + pct_white + pct_black + pct_unemployed
|
| 622 |
+
+ pct_college + log_per_cap_inc + gini + south + non_rural
|
| 623 |
+
+ log_pop_density,
|
| 624 |
+
data = dta %>% filter(white == 1 & pct_white >= quantile(dta$pct_white, 0.9, na.rm = TRUE)),
|
| 625 |
+
clusters = zipcode, se_type = "stata")
|
| 626 |
+
|
| 627 |
+
## Table of coefs., and save
|
| 628 |
+
###############
|
| 629 |
+
## TABLE A15 ##
|
| 630 |
+
###############
|
| 631 |
+
texreg(list(pres_dem_90, house_dem_90, rr_90, affirm_90),
|
| 632 |
+
file = "03_output/p90.tex",
|
| 633 |
+
label = "p90",
|
| 634 |
+
caption = "Racial Flux, Voting Behavior, and Racial Attitudes (Whites) --- % White > 90th Percentile",
|
| 635 |
+
custom.model.names = c("\\textit{President}", "\\textit{U.S. House}", "\\textit{Racial Resentment}",
|
| 636 |
+
"\\textit{Affirmative Action}"),
|
| 637 |
+
custom.coef.names = c("Intercept", "% Black Workers", "Party ID",
|
| 638 |
+
"Ideology", "Female", "Age", "Family Income",
|
| 639 |
+
"Education", "% White", "% Black",
|
| 640 |
+
"% Unemployed", "% College",
|
| 641 |
+
"log(Per Capita Income)", "Gini Coef.", "South",
|
| 642 |
+
"Non-Rural", "log(Pop. Density)"),
|
| 643 |
+
reorder.coef = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1),
|
| 644 |
+
custom.gof.names = c(NA, NA, "Observations", NA, NA),
|
| 645 |
+
stars = c(0.05, 0.01, 0.001),
|
| 646 |
+
digits = 3,
|
| 647 |
+
center = TRUE,
|
| 648 |
+
include.ci = FALSE,
|
| 649 |
+
caption.above = TRUE,
|
| 650 |
+
scalebox = 0.7)
|
4/replication_package/dta.RData
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8e0162578ffce79c472e8f599bcbead101397fa93248c82b433b2124087ac8fe
|
| 3 |
+
size 9079006
|
4/replication_package/racial_flux.RData
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:948c3dce81ba842ba3cd7292a8fb992391025a9a6861aab344c7bb4abfb7e707
|
| 3 |
+
size 303333
|
4/replication_package/readme.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:033cfb988cc7fd12f856475cc26669e5e7315bad4cf983b005ac13bffcd4eee0
|
| 3 |
+
size 670
|
4/should_reproduce.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:355986b3de113d57f142f3c12760e0adfec4f983e34aa6535d850a9315dc6d9c
|
| 3 |
+
size 17
|