anonymous-submission-acl2025 commited on
Commit
1b9effb
·
1 Parent(s): 8aaef25
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. 32/paper.pdf +3 -0
  2. 32/replication_package/1-ReadMe.txt +3 -0
  3. 32/replication_package/ContextAnalysis_Appendix.R +719 -0
  4. 32/replication_package/ContextAnalysis_Main.R +214 -0
  5. 32/replication_package/Help.R +177 -0
  6. 32/replication_package/SurveyAnalysis_Appendix.R +810 -0
  7. 32/replication_package/SurveyAnalysis_Main.R +378 -0
  8. 32/replication_package/YouGov.dta +3 -0
  9. 32/replication_package/codebook_YouGov.pdf +3 -0
  10. 32/replication_package/codebook_context.pdf +3 -0
  11. 32/replication_package/codebook_context_placebo.pdf +3 -0
  12. 32/replication_package/codebook_survey.pdf +3 -0
  13. 32/replication_package/context.dta +3 -0
  14. 32/replication_package/context_placebo.dta +3 -0
  15. 32/replication_package/master.R +10 -0
  16. 32/replication_package/merge_context.R +217 -0
  17. 32/replication_package/merge_context_placebo.R +231 -0
  18. 32/replication_package/number_in_texts.R +223 -0
  19. 32/replication_package/out_count_table.rdata +3 -0
  20. 32/replication_package/produce_context_data.do +89 -0
  21. 32/replication_package/source_context.pdf +3 -0
  22. 32/replication_package/source_context_placebo.pdf +3 -0
  23. 32/replication_package/source_data/area_mun.dta +3 -0
  24. 32/replication_package/source_data/base.dta +3 -0
  25. 32/replication_package/source_data/base_pl.dta +3 -0
  26. 32/replication_package/source_data/crime.dta +3 -0
  27. 32/replication_package/source_data/education.dta +3 -0
  28. 32/replication_package/source_data/hate.dta +3 -0
  29. 32/replication_package/source_data/merged_context_1.dta +3 -0
  30. 32/replication_package/source_data/merged_context_2.dta +3 -0
  31. 32/replication_package/source_data/pop_gemeinde_2008_2018.dta +3 -0
  32. 32/replication_package/source_data/pop_kreise_2015_2017.dta +3 -0
  33. 32/replication_package/source_data/population.dta +3 -0
  34. 32/replication_package/source_data/refugee_gender.dta +3 -0
  35. 32/replication_package/source_data/refugees_2008_2017.dta +3 -0
  36. 32/replication_package/source_data/sectors.dta +3 -0
  37. 32/replication_package/source_data/unempl_gemeinde_2008_2017.dta +3 -0
  38. 32/replication_package/source_data/unemployment.dta +3 -0
  39. 32/replication_package/source_data/voting.dta +3 -0
  40. 32/replication_package/survey.dta +3 -0
  41. 32/replication_package/table1.tex +34 -0
  42. 32/replication_package/table_C1.tex +62 -0
  43. 32/replication_package/table_C2.tex +62 -0
  44. 32/replication_package/table_C3.tex +64 -0
  45. 32/replication_package/table_C4.tex +62 -0
  46. 32/replication_package/table_C5.tex +63 -0
  47. 32/replication_package/table_C6.tex +68 -0
  48. 32/replication_package/table_C7.tex +65 -0
  49. 32/replication_package/table_C9.tex +26 -0
  50. 32/replication_package/table_D5_1.tex +34 -0
32/paper.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bcf5bb75e799ab4e1e3711ba7844a57acaa2d088d432e5da697abba065bb4d3f
3
+ size 411956
32/replication_package/1-ReadMe.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d5234931ac466ad3e769724309900ec8438f8fe1481002da79633f1fbca043a
3
+ size 7074
32/replication_package/ContextAnalysis_Appendix.R ADDED
@@ -0,0 +1,719 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Replication File for Appendix Survey Analyses
2
+ # Table C1 in Appendix C1: The Effect of Excess Males on the Probability of Observing at least One Hate Crime
3
+ # Table C2 in Appendix C2: The Effect of Excess Males on the Probability of Observing at least One Hate Crime (Different Definition of “Excess Males”)
4
+ # Table C3 in Appendix C3: The Effect of Excess Males on the Probability of Observing at least One Hate Crime (linear probability model)
5
+ # Table C4 in Appendix C4: The Effect of Excess Males on the Probability of Observing at least One Physical Attack
6
+ # Table C5 in Appendix C5: Negative Binomial Regression
7
+ # Table C6 in Appendix C6: Interaction between Excess Males and East/West Germany
8
+ # Table C7 in Appendix C7: Interaction between Excess Males and Refugee Inflow
9
+ # Table C9 in Appendix C9: Placebo Analysis
10
+ # Appendix C10: Descriptive Statistics
11
+
12
+ # R version 4.0.2 (2020-06-22)
13
+
14
+ rm(list=ls())
15
+ # install.packages("readstata13") # readstata13_0.9.2
16
+ # install.packages("MASS") # MASS_7.3-51.6
17
+ # install.packages("sandwich") # sandwich_2.5-1
18
+ # install.packages("lmtest") # lmtest_0.9-37
19
+ # install.packages("stargazer") # stargazer_5.2.2
20
+
21
+ require(readstata13) # readstata13_0.9.2
22
+ require(MASS) # MASS_7.3-51.6
23
+ require(sandwich) # sandwich_2.5-1
24
+ require(lmtest) # lmtest_0.9-37
25
+ require(stargazer) # stargazer_5.2.2
26
+ source("Help.R")
27
+
28
+ dat <- read.dta13("context.dta")
29
+
30
+ dat_2015 <- dat[dat$year == 2015, ]
31
+ dat_2016 <- dat[dat$year == 2016, ]
32
+ dat_2017 <- dat[dat$year == 2017, ]
33
+ dat_2015$Hate_all_muni_1517 <- dat_2015$Hate_all_muni + dat_2016$Hate_all_muni + dat_2017$Hate_all_muni
34
+ dat_2015$Hate_all_muni_1517_bin <- ifelse(dat_2015$Hate_all_muni_1517 > 0, 1, 0)
35
+
36
+ # Remove Extreme Value of Excess Males
37
+ range_x <- quantile(dat_2015$pop_15_44_muni_gendergap_2015, c(0.025, 0.975), na.rm = TRUE)
38
+ dat_2015_s <- dat_2015[dat_2015$pop_15_44_muni_gendergap_2015 >= range_x[1] &
39
+ dat_2015$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
40
+ dat_s <- dat[dat$pop_15_44_muni_gendergap_2015 >= range_x[1] &
41
+ dat$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
42
+
43
+ # ##########################################
44
+ # Main Table (Table C1 in Appendix C1)
45
+ # ##########################################
46
+ bin_1_sum <- bin.summary(Hate_all_muni_1517_bin ~
47
+ pop_15_44_muni_gendergap_2015 +
48
+ log_population_muni_2015 + log_popdens_muni_2015 +
49
+ as.factor(ags_county), # county fixed effects
50
+ id = "ags_county", data = dat_2015_s)
51
+
52
+ bin_1_p <- bin.summary(Hate_all_muni_bin ~
53
+ pop_15_44_muni_gendergap_2015 +
54
+ log_population_muni_2015 + log_popdens_muni_2015 +
55
+ as.factor(ags_county) + as.factor(year), # county + year fixed effects
56
+ id = "ags_county", data = dat_s)
57
+
58
+ bin_2_sum <- bin.summary(Hate_all_muni_1517_bin ~
59
+ pop_15_44_muni_gendergap_2015 +
60
+ log_population_muni_2015 + log_popdens_muni_2015 +
61
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
62
+ as.factor(ags_county), # county fixed effects
63
+ id = "ags_county", data = dat_2015_s)
64
+
65
+ bin_2_p <- bin.summary(Hate_all_muni_bin ~
66
+ pop_15_44_muni_gendergap_2015 +
67
+ log_population_muni_2015 + log_popdens_muni_2015 +
68
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
69
+ as.factor(ags_county) + as.factor(year), # county + year fixed effects
70
+ id = "ags_county", data = dat_s)
71
+
72
+ bin_3_sum <- bin.summary(Hate_all_muni_1517_bin ~
73
+ pop_15_44_muni_gendergap_2015 +
74
+ log_population_muni_2015 + log_popdens_muni_2015 +
75
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
76
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
77
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
78
+ unemp_gendergap_2015 +
79
+ as.factor(ags_state), # state fixed effects
80
+ id = "ags_county", data = dat_2015_s)
81
+
82
+ bin_3_p <- bin.summary(Hate_all_muni_bin ~
83
+ pop_15_44_muni_gendergap_2015 +
84
+ log_population_muni_2015 + log_popdens_muni_2015 +
85
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
86
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
87
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
88
+ unemp_gendergap_2015 +
89
+ as.factor(ags_state) + as.factor(year), # state + year fixed effects
90
+ id = "ags_county", data = dat_s)
91
+
92
+ fit_list <- list(bin_1_sum$fit, bin_1_p$fit,
93
+ bin_2_sum$fit, bin_2_p$fit,
94
+ bin_3_sum$fit, bin_3_p$fit)
95
+ se_list <- list(sqrt(diag(bin_1_sum$vcov)), sqrt(diag(bin_1_p$vcov)),
96
+ sqrt(diag(bin_2_sum$vcov)), sqrt(diag(bin_2_p$vcov)),
97
+ sqrt(diag(bin_3_sum$vcov)), sqrt(diag(bin_3_p$vcov)))
98
+
99
+ star_out(stargazer(fit_list, se = se_list,
100
+ covariate.labels = c("Excess Males (Age 15 - 44)",
101
+ "Log (Population)","Log (Population Density)",
102
+ "Log (Unemployment Rate)",
103
+ "% of population change (2011 vs 2015)",
104
+ "Vote share for AfD (2013)",
105
+ "Log (Refugee Inflow) (2014 vs 2015)", "Log (Refugee Size) (2014)",
106
+ "Log (General Violence per capita)",
107
+ "% of High Education",
108
+ "Change in Manufacturing Share (2011 vs 2015)",
109
+ "Share of Manufacturing", "Male Disadvantage"),
110
+ keep=c("pop_15_44_muni_gendergap_2015",
111
+ "log_population_muni_2015",
112
+ "log_popdens_muni_2015", "log_unemp_all_muni_2015",
113
+ "d_pop1511_muni", "vote_afd_2013_muni",
114
+ "log_ref_inflow_1514", "log_pop_ref_2014",
115
+ "log_violence_percap_2015",
116
+ "pc_hidegree_all2011", "d_manuf1115", "pc_manufacturing_2015", "unemp_gendergap_2015")),
117
+ name = "table_C1.tex")
118
+
119
+ # ###############################################
120
+ # Replicate Table with 25-44 (Table C2 in C2)
121
+ # ###############################################
122
+ range_x2 <- quantile(dat_2015$pop_25_44_muni_gendergap_2015, c(0.025, 0.975), na.rm = TRUE)
123
+ dat_2015_s2 <- dat_2015[dat_2015$pop_25_44_muni_gendergap_2015 >= range_x2[1] &
124
+ dat_2015$pop_25_44_muni_gendergap_2015 <= range_x2[2], ]
125
+ dat_s2 <- dat[dat$pop_25_44_muni_gendergap_2015 >= range_x2[1] &
126
+ dat$pop_25_44_muni_gendergap_2015 <= range_x2[2], ]
127
+
128
+
129
+ bin_r_1_sum <- bin.summary(Hate_all_muni_1517_bin ~
130
+ pop_25_44_muni_gendergap_2015 +
131
+ log_population_muni_2015 + log_popdens_muni_2015 +
132
+ as.factor(ags_county),
133
+ id = "ags_county", data = dat_2015_s2)
134
+
135
+ bin_r_1_p <- bin.summary(Hate_all_muni_bin ~
136
+ pop_25_44_muni_gendergap_2015 +
137
+ log_population_muni_2015 + log_popdens_muni_2015 +
138
+ as.factor(ags_county) + as.factor(year),
139
+ id = "ags_county", data = dat_s2)
140
+
141
+ bin_r_2_sum <- bin.summary(Hate_all_muni_1517_bin ~
142
+ pop_25_44_muni_gendergap_2015 +
143
+ log_population_muni_2015 + log_popdens_muni_2015 +
144
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
145
+ as.factor(ags_county),
146
+ id = "ags_county", data = dat_2015_s2)
147
+
148
+ bin_r_2_p <- bin.summary(Hate_all_muni_bin ~
149
+ pop_25_44_muni_gendergap_2015 +
150
+ log_population_muni_2015 + log_popdens_muni_2015 +
151
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
152
+ as.factor(ags_county) + as.factor(year),
153
+ id = "ags_county", data = dat_s2)
154
+
155
+ bin_r_3_sum <- bin.summary(Hate_all_muni_1517_bin ~
156
+ pop_25_44_muni_gendergap_2015 +
157
+ log_population_muni_2015 + log_popdens_muni_2015 +
158
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
159
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
160
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
161
+ unemp_gendergap_2015 +
162
+ as.factor(ags_state),
163
+ id = "ags_county", data = dat_2015_s2)
164
+
165
+ bin_r_3_p <- bin.summary(Hate_all_muni_bin ~
166
+ pop_25_44_muni_gendergap_2015 +
167
+ log_population_muni_2015 + log_popdens_muni_2015 +
168
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
169
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
170
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
171
+ unemp_gendergap_2015 +
172
+ as.factor(ags_state) + as.factor(year),
173
+ id = "ags_county", data = dat_s2)
174
+
175
+
176
+ ## Table C2 in Appendix C2
177
+ fit_list2 <- list(bin_r_1_sum$fit, bin_r_1_p$fit,
178
+ bin_r_2_sum$fit, bin_r_2_p$fit,
179
+ bin_r_3_sum$fit, bin_r_3_p$fit)
180
+ se_list2 <- list(sqrt(diag(bin_r_1_sum$vcov)), sqrt(diag(bin_r_1_p$vcov)),
181
+ sqrt(diag(bin_r_2_sum$vcov)), sqrt(diag(bin_r_2_p$vcov)),
182
+ sqrt(diag(bin_r_3_sum$vcov)), sqrt(diag(bin_r_3_p$vcov)))
183
+
184
+ star_out(stargazer(fit_list2, se = se_list2,
185
+ covariate.labels = c("Excess Males (Age 25 - 44)",
186
+ "Log (Population)","Log (Population Density)",
187
+ "Log (Unemployment Rate)",
188
+ "% of population change (2011 vs 2015)",
189
+ "Vote share for AfD (2013)",
190
+ "Log (Refugee Inflow) (2014 vs 2015)", "Log (Refugee Size) (2014)",
191
+ "Log (General Violence per capita)",
192
+ "% of High Education",
193
+ "Change in Manufacturing Share (2011 vs 2015)",
194
+ "Share of Manufacturing", "Male Disadvantage"),
195
+ keep=c("pop_25_44_muni_gendergap_2015",
196
+ "log_population_muni_2015",
197
+ "log_popdens_muni_2015", "log_unemp_all_muni_2015",
198
+ "d_pop1511_muni", "vote_afd_2013_muni",
199
+ "log_ref_inflow_1514", "log_pop_ref_2014",
200
+ "log_violence_percap_2015",
201
+ "pc_hidegree_all2011", "d_manuf1115", "pc_manufacturing_2015", "unemp_gendergap_2015")),
202
+ name = "table_C2.tex")
203
+
204
+ # #####################################
205
+ # Linear Probability Model (Table C3 in Appendix C3)
206
+ # #####################################
207
+ lm_1_sum <- lm.summary(Hate_all_muni_1517_bin ~
208
+ pop_15_44_muni_gendergap_2015 +
209
+ log_population_muni_2015 + log_popdens_muni_2015 +
210
+ as.factor(ags_county),
211
+ id = "ags_county", data = dat_2015_s)
212
+
213
+ lm_1_p <- lm.summary(Hate_all_muni_bin ~
214
+ pop_15_44_muni_gendergap_2015 +
215
+ log_population_muni_2015 + log_popdens_muni_2015 +
216
+ as.factor(ags_county) + as.factor(year),
217
+ id = "ags_county", data = dat_s)
218
+
219
+ lm_2_sum <- lm.summary(Hate_all_muni_1517_bin ~
220
+ pop_15_44_muni_gendergap_2015 +
221
+ log_population_muni_2015 + log_popdens_muni_2015 +
222
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
223
+ as.factor(ags_county),
224
+ id = "ags_county", data = dat_2015_s)
225
+
226
+ lm_2_p <- lm.summary(Hate_all_muni_bin ~
227
+ pop_15_44_muni_gendergap_2015 +
228
+ log_population_muni_2015 + log_popdens_muni_2015 +
229
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
230
+ as.factor(ags_county) + as.factor(year),
231
+ id = "ags_county", data = dat_s)
232
+
233
+ lm_3_sum <- lm.summary(Hate_all_muni_1517_bin ~
234
+ pop_15_44_muni_gendergap_2015 +
235
+ log_population_muni_2015 + log_popdens_muni_2015 +
236
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
237
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
238
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
239
+ unemp_gendergap_2015 +
240
+ as.factor(ags_state),
241
+ id = "ags_county", data = dat_2015_s)
242
+
243
+ lm_3_p <- lm.summary(Hate_all_muni_bin ~
244
+ pop_15_44_muni_gendergap_2015 +
245
+ log_population_muni_2015 + log_popdens_muni_2015 +
246
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
247
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
248
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
249
+ unemp_gendergap_2015 +
250
+ as.factor(ags_state) + as.factor(year),
251
+ id = "ags_county", data = dat_s)
252
+
253
+
254
+ fit_list_lm <- list(lm_1_sum$fit, lm_1_p$fit,
255
+ lm_2_sum$fit, lm_2_p$fit,
256
+ lm_3_sum$fit, lm_3_p$fit)
257
+ se_list_lm <- list(sqrt(diag(lm_1_sum$vcov)), sqrt(diag(lm_1_p$vcov)),
258
+ sqrt(diag(lm_2_sum$vcov)), sqrt(diag(lm_2_p$vcov)),
259
+ sqrt(diag(lm_3_sum$vcov)), sqrt(diag(lm_3_p$vcov)))
260
+
261
+ star_out(stargazer(fit_list_lm, se = se_list_lm,
262
+ covariate.labels = c("Excess Males (Age 15 - 44)",
263
+ "Log (Population)","Log (Population Density)",
264
+ "Log (Unemployment Rate)",
265
+ "% of population change (2011 vs 2015)",
266
+ "Vote share for AfD (2013)",
267
+ "Log (Refugee Inflow) (2014 vs 2015)", "Log (Refugee Size) (2014)",
268
+ "Log (General Violence per capita)",
269
+ "% of High Education",
270
+ "Change in Manufacturing Share (2011 vs 2015)",
271
+ "Share of Manufacturing", "Male Disadvantage"),
272
+ keep=c("pop_15_44_muni_gendergap_2015",
273
+ "log_population_muni_2015",
274
+ "log_popdens_muni_2015", "log_unemp_all_muni_2015",
275
+ "d_pop1511_muni", "vote_afd_2013_muni",
276
+ "log_ref_inflow_1514", "log_pop_ref_2014",
277
+ "log_violence_percap_2015",
278
+ "pc_hidegree_all2011", "d_manuf1115", "pc_manufacturing_2015", "unemp_gendergap_2015")),
279
+ name = "table_C3.tex")
280
+
281
+
282
+ ## ############################################
283
+ ## Physical Attacks (Table C4 in Appendix C4)
284
+ ## ############################################
285
+ dat_2015$Physical_muni_1517 <- dat_2015$Physical_muni + dat_2016$Physical_muni + dat_2017$Physical_muni
286
+ dat_2015$Physical_muni_1517_bin <- ifelse(dat_2015$Physical_muni_1517 > 0, 1, 0)
287
+ range_x <- quantile(dat_2015$pop_15_44_muni_gendergap_2015, c(0.025, 0.975), na.rm = TRUE)
288
+ dat_2015_s <- dat_2015[dat_2015$pop_15_44_muni_gendergap_2015 >= range_x[1] &
289
+ dat_2015$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
290
+ dat_s <- dat[dat$pop_15_44_muni_gendergap_2015 >= range_x[1] &
291
+ dat$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
292
+
293
+ bin_phys_1_sum <- bin.summary(Physical_muni_1517_bin ~
294
+ pop_15_44_muni_gendergap_2015 +
295
+ log_population_muni_2015 + log_popdens_muni_2015 +
296
+ as.factor(ags_county),
297
+ id = "ags_county", data = dat_2015_s)
298
+
299
+ bin_phys_1_p <- bin.summary(Physical_muni_bin ~
300
+ pop_15_44_muni_gendergap_2015 +
301
+ log_population_muni_2015 + log_popdens_muni_2015 +
302
+ as.factor(ags_county) + as.factor(year),
303
+ id = "ags_county", data = dat_s)
304
+
305
+ bin_phys_2_sum <- bin.summary(Physical_muni_1517_bin ~
306
+ pop_15_44_muni_gendergap_2015 +
307
+ log_population_muni_2015 + log_popdens_muni_2015 +
308
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
309
+ as.factor(ags_county),
310
+ id = "ags_county", data = dat_2015_s)
311
+
312
+ bin_phys_2_p <- bin.summary(Physical_muni_bin ~
313
+ pop_15_44_muni_gendergap_2015 +
314
+ log_population_muni_2015 + log_popdens_muni_2015 +
315
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
316
+ as.factor(ags_county) + as.factor(year),
317
+ id = "ags_county", data = dat_s)
318
+
319
+ bin_phys_3_sum <- bin.summary(Physical_muni_1517_bin ~
320
+ pop_15_44_muni_gendergap_2015 +
321
+ log_population_muni_2015 + log_popdens_muni_2015 +
322
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
323
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
324
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
325
+ unemp_gendergap_2015 +
326
+ as.factor(ags_state),
327
+ id = "ags_county", data = dat_2015_s)
328
+
329
+ bin_phys_3_p <- bin.summary(Physical_muni_bin ~
330
+ pop_15_44_muni_gendergap_2015 +
331
+ log_population_muni_2015 + log_popdens_muni_2015 +
332
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
333
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
334
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
335
+ unemp_gendergap_2015 +
336
+ as.factor(ags_state) + as.factor(year),
337
+ id = "ags_county", data = dat_s)
338
+
339
+ ## Table C4 in Appendix C4
340
+ fit_list_bin_phys <- list(bin_phys_1_sum$fit, bin_phys_1_p$fit,
341
+ bin_phys_2_sum$fit, bin_phys_2_p$fit,
342
+ bin_phys_3_sum$fit, bin_phys_3_p$fit)
343
+ se_list_bin_phys <- list(sqrt(diag(bin_phys_1_sum$vcov)), sqrt(diag(bin_phys_1_p$vcov)),
344
+ sqrt(diag(bin_phys_2_sum$vcov)), sqrt(diag(bin_phys_2_p$vcov)),
345
+ sqrt(diag(bin_phys_3_sum$vcov)), sqrt(diag(bin_phys_3_p$vcov)))
346
+
347
+ star_out(stargazer(fit_list_bin_phys, se = se_list_bin_phys,
348
+ covariate.labels = c("Excess Males (Age 15 - 44)",
349
+ "Log (Population)","Log (Population Density)",
350
+ "Log (Unemployment Rate)",
351
+ "% of population change (2011 vs 2015)",
352
+ "Vote share for AfD (2013)",
353
+ "Log (Refugee Inflow) (2014 vs 2015)", "Log (Refugee Size) (2014)",
354
+ "Log (General Violence per capita)",
355
+ "% of High Education",
356
+ "Change in Manufacturing Share (2011 vs 2015)",
357
+ "Share of Manufacturing", "Male Disadvantage"),
358
+ keep=c("pop_15_44_muni_gendergap_2015",
359
+ "log_population_muni_2015",
360
+ "log_popdens_muni_2015", "log_unemp_all_muni_2015",
361
+ "d_pop1511_muni", "vote_afd_2013_muni",
362
+ "log_ref_inflow_1514", "log_pop_ref_2014",
363
+ "log_violence_percap_2015",
364
+ "pc_hidegree_all2011", "d_manuf1115", "pc_manufacturing_2015", "unemp_gendergap_2015")),
365
+ name = "table_C4.tex")
366
+
367
+ ## ########################################
368
+ ## Appendix C5: Count Model
369
+ ## ########################################
370
+ rm(list=ls())
371
+
372
+ dat <- read.dta13("context.dta")
373
+ source("Help.R")
374
+
375
+ dat_2015 <- dat[dat$year == 2015, ]
376
+ dat_2016 <- dat[dat$year == 2016, ]
377
+ dat_2017 <- dat[dat$year == 2017, ]
378
+ dat_2015$Hate_all_muni_1517 <- dat_2015$Hate_all_muni + dat_2016$Hate_all_muni + dat_2017$Hate_all_muni
379
+
380
+ # Remove Extreme Value of Excess Males
381
+ range_x <- quantile(dat_2015$pop_15_44_muni_gendergap_2015, c(0.025, 0.975), na.rm = TRUE)
382
+ dat_2015_s <- dat_2015[dat_2015$pop_15_44_muni_gendergap_2015 >= range_x[1] &
383
+ dat_2015$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
384
+ dat_s <- dat[dat$pop_15_44_muni_gendergap_2015 >= range_x[1] &
385
+ dat$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
386
+
387
+ for_s <- as.formula(Hate_all_muni_1517 ~
388
+ pop_15_44_muni_gendergap_2015 +
389
+ log_population_muni_2015 + log_popdens_muni_2015 +
390
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
391
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
392
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
393
+ unemp_gendergap_2015 +
394
+ as.factor(ags_state)) # state fixed effects
395
+
396
+ for_p <- as.formula(Hate_all_muni ~
397
+ pop_15_44_muni_gendergap_2015 +
398
+ log_population_muni_2015 + log_popdens_muni_2015 +
399
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
400
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
401
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
402
+ unemp_gendergap_2015 + as.factor(ags_state) + as.factor(year)) # state + year fixed effects
403
+
404
+ ## Use boostrap to compute standard errors (Use the "out_count.rdata" to get the exact same estimates)
405
+ ## Note: the following codes take a while to run
406
+ full_run <- FALSE
407
+ if(full_run == TRUE){
408
+ # Sum
409
+ nb_1_sum_b <- glm.boot(for_s, family = "negative-binomial",
410
+ data = dat_2015_s,
411
+ cluster_id = dat_2015_s$ags_county)
412
+
413
+ # Panel
414
+ nb_1_p_b <- glm.boot(for_p, family = "negative-binomial",
415
+ data = dat_s,
416
+ cluster_id = dat_s$ags_county)
417
+
418
+ fit_list_nb <- list(nb_1_sum_b$fit, nb_1_p_b$fit)
419
+ se_list_nb <- list(nb_1_sum_b$se, nb_1_p_b$se)
420
+
421
+ out_count_table <- list(fit_list_nb, se_list_nb)
422
+ save(out_count_table, file = "out_count_table.rdata")
423
+ }
424
+
425
+ load(file = "out_count_table.rdata")
426
+ fit_list_nb <- out_count_table[[1]]
427
+ se_list_nb <- out_count_table[[2]]
428
+
429
+ star_out(stargazer(fit_list_nb, se = se_list_nb,
430
+ covariate.labels = c("Excess Males (Age 15 - 44)",
431
+ "Log (Population)","Log (Population Density)",
432
+ "Log (Unemployment Rate)",
433
+ "% of population change (2011 vs 2015)",
434
+ "Vote share for AfD (2013)",
435
+ "Log (Refugee Inflow) (2014 vs 2015)", "Log (Refugee Size) (2014)",
436
+ "Log (General Violence per capita)",
437
+ "% of High Education",
438
+ "Change in Manufacturing Share (2011 vs 2015)",
439
+ "Share of Manufacturing", "Male Disadvantage"),
440
+ keep=c("pop_15_44_muni_gendergap_2015",
441
+ "log_population_muni_2015",
442
+ "log_popdens_muni_2015", "log_unemp_all_muni_2015",
443
+ "d_pop1511_muni", "vote_afd_2013_muni",
444
+ "log_ref_inflow_1514", "log_pop_ref_2014",
445
+ "log_violence_percap_2015",
446
+ "pc_hidegree_all2011", "d_manuf1115", "pc_manufacturing_2015", "unemp_gendergap_2015")),
447
+ name = "table_C5.tex")
448
+
449
+
450
+
451
+ ## ########################################################################
452
+ ## Replicate Tables with East/West Interaction (Table C6 in Appendix C6)
453
+ ## ########################################################################
454
+ rm(list=ls())
455
+
456
+ dat <- read.dta13("context.dta")
457
+ source("Help.R")
458
+
459
+ dat_2015 <- dat[dat$year == 2015, ]
460
+ dat_2016 <- dat[dat$year == 2016, ]
461
+ dat_2017 <- dat[dat$year == 2017, ]
462
+ dat_2015$Hate_all_muni_1517 <- dat_2015$Hate_all_muni + dat_2016$Hate_all_muni + dat_2017$Hate_all_muni
463
+ dat_2015$Hate_all_muni_1517_bin <- as.numeric(dat_2015$Hate_all_muni_1517 > 0)
464
+
465
+ # Remove Extreme Value of Excess Males
466
+ range_x <- quantile(dat_2015$pop_15_44_muni_gendergap_2015, c(0.025, 0.975), na.rm = TRUE)
467
+ dat_2015_s <- dat_2015[dat_2015$pop_15_44_muni_gendergap_2015 >= range_x[1] &
468
+ dat_2015$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
469
+ dat_s <- dat[dat$pop_15_44_muni_gendergap_2015 >= range_x[1] &
470
+ dat$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
471
+
472
+ dat_2015_s$west <- 1 - dat_2015_s$east
473
+ dat_s$west <- 1 - dat_s$east
474
+
475
+ bin_2_sum_ew <- bin.summary(Hate_all_muni_1517_bin ~
476
+ pop_15_44_muni_gendergap_2015 + west +
477
+ log_population_muni_2015 + log_popdens_muni_2015 +
478
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
479
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
480
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
481
+ unemp_gendergap_2015,
482
+ id = "ags_county", data = dat_2015_s)
483
+
484
+ bin_2_p_ew <- bin.summary(Hate_all_muni_bin ~
485
+ pop_15_44_muni_gendergap_2015 + west +
486
+ log_population_muni_2015 + log_popdens_muni_2015 +
487
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
488
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
489
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
490
+ unemp_gendergap_2015 + as.factor(year),
491
+ id = "ags_county", data = dat_s)
492
+
493
+ bin_3_sum_ew <- bin.summary(Hate_all_muni_1517_bin ~
494
+ pop_15_44_muni_gendergap_2015*west +
495
+ log_population_muni_2015 + log_popdens_muni_2015 +
496
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
497
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
498
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
499
+ unemp_gendergap_2015,
500
+ id = "ags_county", data = dat_2015_s)
501
+
502
+ bin_3_p_ew <- bin.summary(Hate_all_muni_bin ~
503
+ pop_15_44_muni_gendergap_2015*west +
504
+ log_population_muni_2015 + log_popdens_muni_2015 +
505
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
506
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
507
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
508
+ unemp_gendergap_2015 + as.factor(year),
509
+ id = "ags_county", data = dat_s)
510
+
511
+ fit_list_ew <- list(bin_2_sum_ew$fit, bin_2_p_ew$fit,
512
+ bin_3_sum_ew$fit, bin_3_p_ew$fit)
513
+ se_list_ew <- list(sqrt(diag(bin_2_sum_ew$vcov)), sqrt(diag(bin_2_p_ew$vcov)),
514
+ sqrt(diag(bin_3_sum_ew$vcov)), sqrt(diag(bin_3_p_ew$vcov)))
515
+
516
+ star_out(stargazer(fit_list_ew, se = se_list_ew,
517
+ covariate.labels = c("Excess Males (Age 15 - 44)", "West",
518
+ "Log (Population)","Log (Population Density)",
519
+ "Log (Unemployment Rate)",
520
+ "% of population change (2011 vs 2015)",
521
+ "Vote share for AfD (2013)",
522
+ "Log (Refugee Inflow) (2014 vs 2015)",
523
+ "Log (Refugee Size) (2014)",
524
+ "Log (General Violence per capita)",
525
+ "% of High Education",
526
+ "Change in Manufacturing Share (2011 vs 2015)",
527
+ "Share of Manufacturing", "Male Disadvantage",
528
+ "Excess Males x West"),
529
+ keep=c("pop_15_44_muni_gendergap_2015", "west",
530
+ "log_population_muni_2015",
531
+ "log_popdens_muni_2015", "log_unemp_all_muni_2015",
532
+ "d_pop1511_muni", "vote_afd_2013_muni",
533
+ "log_ref_inflow_1514",
534
+ "log_pop_ref_2014",
535
+ "log_violence_percap_2015",
536
+ "pc_hidegree_all2011", "d_manuf1115", "pc_manufacturing_2015", "unemp_gendergap_2015",
537
+ "pop_15_44_muni_gendergap_2015:west")),
538
+ name = "table_C6.tex")
539
+
540
+
541
+ ## ##############################################################
542
+ ## Interaction with Refugee Inflow (Table C7 in Appendix C7)
543
+ ## ##############################################################
544
+ bin_sum_int <- bin.summary(Hate_all_muni_1517_bin ~
545
+ pop_15_44_muni_gendergap_2015*log_ref_inflow_1514 +
546
+ log_population_muni_2015 + log_popdens_muni_2015 +
547
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
548
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
549
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
550
+ unemp_gendergap_2015 +
551
+ as.factor(ags_state),
552
+ id = "ags_county", data = dat_2015_s)
553
+
554
+ bin_p_int <- bin.summary(Hate_all_muni_bin ~
555
+ pop_15_44_muni_gendergap_2015*log_ref_inflow_1514 +
556
+ log_population_muni_2015 + log_popdens_muni_2015 +
557
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
558
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
559
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
560
+ unemp_gendergap_2015 +
561
+ as.factor(ags_state) + as.factor(year),
562
+ id = "ags_county", data = dat_s)
563
+
564
+ ## Table C7 in Appendix C7
565
+ fit_list_int <- list(bin_sum_int$fit, bin_p_int$fit)
566
+ se_list_int <- list(sqrt(diag(bin_sum_int$vcov)), sqrt(diag(bin_p_int$vcov)))
567
+
568
+ star_out(stargazer(fit_list_int, se = se_list_int,
569
+ covariate.labels = c("Excess Males (Age 15 - 44)",
570
+ "Log (Refugee Inflow) (2014 vs 2015)",
571
+ "Log (Population)","Log (Population Density)",
572
+ "Log (Unemployment Rate)",
573
+ "% of population change (2011 vs 2015)",
574
+ "Vote share for AfD (2013)",
575
+ "Log (Refugee Size) (2014)",
576
+ "Log (General Violence per capita)",
577
+ "% of High Education",
578
+ "Change in Manufacturing Share (2011 vs 2015)",
579
+ "Share of Manufacturing", "Male Disadvantage",
580
+ "Excess Males × Log (Refugee Inflow)"),
581
+ keep=c("pop_15_44_muni_gendergap_2015", "log_ref_inflow_1514",
582
+ "log_population_muni_2015",
583
+ "log_popdens_muni_2015", "log_unemp_all_muni_2015",
584
+ "d_pop1511_muni", "vote_afd_2013_muni",
585
+ "log_pop_ref_2014",
586
+ "log_violence_percap_2015",
587
+ "pc_hidegree_all2011", "d_manuf1115", "pc_manufacturing_2015", "unemp_gendergap_2015",
588
+ "pop_15_44_muni_gendergap_2015:log_ref_inflow_1514")),
589
+ name = "table_C7.tex")
590
+
591
+ # ################################################################
592
+ # Appendix C9. Placebo Analysis
593
+ # ###############################################################
594
+ rm(list=ls())
595
+
596
+ dat_pl <- read.dta13("context_placebo.dta") # data for placebo analysis
597
+ source("Help.R")
598
+
599
+ dat_2015_s <- dat_pl[dat_pl$year == 2015, ]
600
+ dat_2016_s <- dat_pl[dat_pl$year == 2016, ]
601
+ dat_2017_s <- dat_pl[dat_pl$year == 2017, ]
602
+
603
+ # ##########################################
604
+ # 2015
605
+ # ##########################################
606
+ # main model + Placebo Treatment
607
+ bin_15_sum_pl <- bin.summary(Hate_all_muni_bin ~
608
+ pop_15_44_muni_gendergap_future +
609
+ pop_15_44_muni_gendergap_anu +
610
+ log(population_muni_anu) + log(popdens_muni_anu) +
611
+ log_unemp_all_muni_anu + d_pop_muni_anu + vote_afd_2013_muni +
612
+ log_ref_inflow_anu + log(pop_ref_anu) + log(violence_percap_anu) + ## county level
613
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
614
+ unemp_gendergap_anu +
615
+ as.factor(ags_state), # state fixed effects
616
+ id = "ags_county", data = dat_2015_s)
617
+
618
+ # ##########################################
619
+ # 2016
620
+ # ##########################################
621
+ # Main model + Placebo
622
+ bin_16_sum_pl <- bin.summary(Hate_all_muni_bin ~ pop_15_44_muni_gendergap_future +
623
+ pop_15_44_muni_gendergap_anu +
624
+ log(population_muni_anu) + log(popdens_muni_anu) +
625
+ log_unemp_all_muni_anu + d_pop_muni_anu + vote_afd_2013_muni +
626
+ log_ref_inflow_anu + log(pop_ref_anu) + log(violence_percap_anu) + ## county level
627
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
628
+ unemp_gendergap_anu +
629
+ as.factor(ags_state), # state fixed effects
630
+ id = "ags_county", data = dat_2016_s)
631
+
632
+ # ##########################
633
+ # 2017
634
+ # #########################
635
+ # Main model + Placebo
636
+ bin_17_sum_pl <- bin.summary(Hate_all_muni_bin ~ pop_15_44_muni_gendergap_future +
637
+ pop_15_44_muni_gendergap_anu +
638
+ log(population_muni_anu) + log(popdens_muni_anu) +
639
+ log_unemp_all_muni_anu + d_pop_muni_anu + vote_afd_2013_muni +
640
+ log_ref_inflow_anu + log(pop_ref_anu) + log(violence_percap_anu) + ## county level
641
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
642
+ unemp_gendergap_anu +
643
+ as.factor(ags_state), # state fixed effects
644
+ id = "ags_county", data = dat_2017_s)
645
+
646
+ ## ####################
647
+ ## Pooled Analysis
648
+ ## ####################
649
+ # Final model + Placebo
650
+ bin_pool_sum_pl <- bin.summary(Hate_all_muni_bin ~ pop_15_44_muni_gendergap_future +
651
+ pop_15_44_muni_gendergap_anu +
652
+ log(population_muni_anu) + log(popdens_muni_anu) +
653
+ log_unemp_all_muni_anu + d_pop_muni_anu + vote_afd_2013_muni +
654
+ log_ref_inflow_anu + log(pop_ref_anu) + log(violence_percap_anu) + ## county level
655
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
656
+ unemp_gendergap_anu +
657
+ as.factor(ags_state) + as.factor(year), # state + year fixed effects
658
+ id = "ags_county", data = dat_pl)
659
+
660
+ # Repeat the analysis for Large Counties
661
+ dat_pool_s_l <- dat_pl[dat_pl$population_muni_anu >
662
+ quantile(dat_pl$population_muni_anu, prob = 0.5), ]
663
+
664
+ # Main model + Placebo
665
+ bin_pool_sum_pl_l <- bin.summary(Hate_all_muni_bin ~ pop_15_44_muni_gendergap_future +
666
+ pop_15_44_muni_gendergap_anu +
667
+ log(population_muni_anu) + log(popdens_muni_anu) +
668
+ log_unemp_all_muni_anu + d_pop_muni_anu + vote_afd_2013_muni +
669
+ log_ref_inflow_anu + log(pop_ref_anu) + log(violence_percap_anu) + ## county level
670
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
671
+ unemp_gendergap_anu +
672
+ as.factor(ags_state) + as.factor(year), # state + year fixed effects
673
+ id = "ags_county", data = dat_pool_s_l)
674
+
675
+ # Table
676
+ pl_fit_list_m <- list(bin_15_sum_pl$fit,
677
+ bin_16_sum_pl$fit,
678
+ bin_17_sum_pl$fit,
679
+ bin_pool_sum_pl$fit,
680
+ bin_pool_sum_pl_l$fit)
681
+ pl_se_list_m <- list(sqrt(diag(bin_15_sum_pl$vcov)),
682
+ sqrt(diag(bin_16_sum_pl$vcov)),
683
+ sqrt(diag(bin_17_sum_pl$vcov)),
684
+ sqrt(diag(bin_pool_sum_pl$vcov)),
685
+ sqrt(diag(bin_pool_sum_pl_l$vcov)))
686
+
687
+ star_out(stargazer(pl_fit_list_m, se = pl_se_list_m,
688
+ covariate.labels = c("Future-Treatment"),
689
+ keep=c("pop_15_44_muni_gendergap_future")),
690
+ name = "table_C9.tex")
691
+
692
+
693
+ # ##############################
694
+ # Appendix C10. Descriptive Statistics
695
+ # ##############################
696
+ rm(list=ls())
697
+
698
+ dat <- read.dta13("context.dta")
699
+
700
+ min15 <- round(min(dat$pc_ref_male[dat$year == 2015], na.rm = TRUE),2)
701
+ min16 <- round(min(dat$pc_ref_male[dat$year == 2016], na.rm = TRUE),2)
702
+
703
+ pdf("figure_C10.pdf", height = 5, width = 10)
704
+ par(mfrow = c(1, 2))
705
+ plot(density(dat$pc_ref_male[dat$year == 2015], na.rm = TRUE),
706
+ main = "Proportion of Male Refugees (2015)",
707
+ xlim = c(50, 100), xlab = "Percent of Male Refugees Among Refugees (county)")
708
+ text(x = 90, y = 0.08, paste0("min = ", min15), font = 2)
709
+ polygon(density(dat$pc_ref_male[dat$year == 2015], na.rm = TRUE)$x,
710
+ density(dat$pc_ref_male[dat$year == 2015], na.rm = TRUE)$y,col='grey80')
711
+
712
+ plot(density(dat$pc_ref_male[dat$year == 2016], na.rm = TRUE),
713
+ main = "Proportion of Male Refugees (2016)", xlim = c(50, 100),
714
+ xlab = "Percent of Male Refugees Among Refugees (county)")
715
+ text(x = 90, y = 0.12, paste0("min = ", min16), font = 2)
716
+ polygon(density(dat$pc_ref_male[dat$year == 2016], na.rm = TRUE)$x,
717
+ density(dat$pc_ref_male[dat$year == 2016], na.rm = TRUE)$y,col='grey80')
718
+ dev.off()
719
+
32/replication_package/ContextAnalysis_Main.R ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Replication File for
2
+ # Figure 1 (Effects of Excess Males on Prob of Hate Crime)
3
+ # Appendix: Figure C8 (Effects of Male Diadvantage on Prob of Hate Crime)
4
+
5
+ # R version 4.0.2 (2020-06-22)
6
+
7
+ rm(list=ls())
8
+ # install.packages("readstata13") # readstata13_0.9.2
9
+ # install.packages("MASS") # MASS_7.3-51.6
10
+ # install.packages("sandwich") # sandwich_2.5-1
11
+ # install.packages("lmtest") # lmtest_0.9-37
12
+
13
+ require(readstata13) # readstata13_0.9.2
14
+ require(MASS) # MASS_7.3-51.6
15
+ require(sandwich) # sandwich_2.5-1
16
+ require(lmtest) # lmtest_0.9-37
17
+ source("Help.R")
18
+
19
+ dat <- read.dta13("context.dta")
20
+
21
+ dat_2015 <- dat[dat$year == 2015, ]
22
+ dat_2016 <- dat[dat$year == 2016, ]
23
+ dat_2017 <- dat[dat$year == 2017, ]
24
+ dat_2015$Hate_all_muni_1517 <- dat_2015$Hate_all_muni + dat_2016$Hate_all_muni + dat_2017$Hate_all_muni
25
+ dat_2015$Hate_all_muni_1517_bin <- ifelse(dat_2015$Hate_all_muni_1517 > 0, 1, 0)
26
+
27
+ ## #########################
28
+ ## Main Figure (Figure 1)
29
+ ## #########################
30
+ # Remove Extreme Value of Excess Males
31
+ range_x <- quantile(dat_2015$pop_15_44_muni_gendergap_2015, c(0.025, 0.975), na.rm = TRUE)
32
+ dat_2015_s <- dat_2015[dat_2015$pop_15_44_muni_gendergap_2015 >= range_x[1] &
33
+ dat_2015$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
34
+ dat_s <- dat[dat$pop_15_44_muni_gendergap_2015 >= range_x[1] &
35
+ dat$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
36
+
37
+ # sum
38
+ bin_1_sum <- bin.summary(Hate_all_muni_1517_bin ~
39
+ pop_15_44_muni_gendergap_2015 +
40
+ log_population_muni_2015 + log_popdens_muni_2015 +
41
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
42
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
43
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
44
+ unemp_gendergap_2015 + as.factor(ags_state),
45
+ id = "ags_county", data = dat_2015_s)
46
+
47
+ # annual
48
+ bin_1_p <- bin.summary(Hate_all_muni_bin ~
49
+ pop_15_44_muni_gendergap_2015 +
50
+ log_population_muni_2015 + log_popdens_muni_2015 +
51
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
52
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
53
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
54
+ unemp_gendergap_2015 + as.factor(ags_state) + as.factor(year),
55
+ id = "ags_county", data = dat_s)
56
+
57
+ # Excess Males
58
+ # Effect Estimation
59
+ bin_1_sum_effect <- marginal_effect(bin_1_sum,
60
+ newdata = dat_2015_s, family = "logit",
61
+ main_var = "pop_15_44_muni_gendergap_2015",
62
+ difference = TRUE,
63
+ treat_range = c(1, 1.2))
64
+
65
+ bin_1_p_effect <- marginal_effect(bin_1_p,
66
+ newdata = dat_s, family = "logit",
67
+ main_var = "pop_15_44_muni_gendergap_2015",
68
+ difference = TRUE,
69
+ treat_range = c(1, 1.2))
70
+
71
+ # Dose function
72
+ bin_1_sum_dose <- marginal_effect(bin_1_sum,
73
+ newdata = dat_2015_s, family = "logit",
74
+ main_var = "pop_15_44_muni_gendergap_2015")
75
+
76
+ bin_1_p_dose <- marginal_effect(bin_1_p,
77
+ newdata = dat_s, family = "logit",
78
+ main_var = "pop_15_44_muni_gendergap_2015")
79
+
80
+
81
+ # Male Diadvantage
82
+ # Effect Estimation
83
+ bin_1_sum_gap <- marginal_effect(bin_1_sum,
84
+ newdata = dat_2015_s, family = "logit",
85
+ main_var = "unemp_gendergap_2015",
86
+ difference = TRUE,
87
+ treat_range = c(1, 1.15))
88
+
89
+ bin_1_p_gap <- marginal_effect(bin_1_p,
90
+ newdata = dat_s, family = "logit",
91
+ main_var = "unemp_gendergap_2015",
92
+ difference = TRUE,
93
+ treat_range = c(1, 1.15))
94
+
95
+ # Dose Function
96
+ bin_1_sum_gap_dose <- marginal_effect(bin_1_sum,
97
+ newdata = dat_2015_s, family = "logit",
98
+ main_var = "unemp_gendergap_2015")
99
+
100
+ bin_1_p_gap_dose <- marginal_effect(bin_1_p,
101
+ newdata = dat_s, family = "logit",
102
+ main_var = "unemp_gendergap_2015")
103
+
104
+ # #####################
105
+ # Plot Effects (Figure 1)
106
+ # #####################
107
+ point <- c(bin_1_sum_effect$out_main[2], bin_1_p_effect$out_main[2])
108
+ high <- c(bin_1_sum_effect$out_main[3], bin_1_p_effect$out_main[3])
109
+ low <- c(bin_1_sum_effect$out_main[1], bin_1_p_effect$out_main[1])
110
+
111
+ ## Short Panel
112
+ marginal_list <- list()
113
+ marginal_list[[1]] <- bin_1_sum_dose
114
+ marginal_list[[2]] <- bin_1_p_dose
115
+
116
+ title_c <- c("Predicted Probability: Sum", "Predicted Probability: Annual")
117
+
118
+ # Plot Dose function
119
+
120
+ pdf("figure_1.pdf", height = 4, width = 11)
121
+ par(mfrow = c(1,3), mar = c(4.5, 2, 4, 1), oma = c(0, 2, 0, 0))
122
+ for(i in 1:2){
123
+ plot_coef_all <- do.call("rbind", marginal_list[[i]]$out_main)
124
+ plot_x <- marginal_list[[i]]$treat_range
125
+ if(i == 1){
126
+ ylim_u <- c(0.14, 0.23)
127
+ ylab_u <- ""
128
+ }
129
+ if(i == 2){
130
+ ylim_u <- c(0.06, 0.11)
131
+ ylab_u <- ""
132
+ }
133
+
134
+ plot(plot_x, plot_coef_all[ ,2], pch = 19,
135
+ main = paste("", title_c[i], sep = ""),
136
+ ylim = ylim_u,
137
+ xlab = "Excess Males",
138
+ ylab = ylab_u,
139
+ col = "black", cex = 2, type = "l", lwd = 3, cex.lab = 1.5, cex.main = 1.5, cex.axis = 1.5)
140
+ lines(plot_x, plot_coef_all[ ,1], col = "black", lty = 2)
141
+ lines(plot_x, plot_coef_all[ ,3], col = "black", lty = 2)
142
+ abline(h = marginal_list[[i]]$sample, lty = 2, col = "red", lwd = 2)
143
+ polygon(c(plot_x, rev(plot_x)), c(plot_coef_all[ ,1], rev(plot_coef_all[ ,3])),
144
+ col = adjustcolor("black", 0.2), border = NA)
145
+ par(new=TRUE)
146
+ hist(dat_2015_s$pop_15_44_muni_gendergap_2015, freq = FALSE,
147
+ breaks = seq(from = 0, to = 6, by = 0.01), xlim = c(min(plot_x), max(plot_x)),
148
+ xaxt = "n", yaxt = "n", xlab = "", ylab = "", ylim = c(0, 40), main ="")
149
+ }
150
+ par(mar = c(4.5, 5, 4, 1))
151
+ plot(seq(1:2), point, ylim = c(-0.005, 0.045),
152
+ ylab = "Effects on Prob (hate crime)",
153
+ main = "Effects of Excess Males",
154
+ xlim = c(0.5, 2.5), xlab = "Outcome Types", xaxt = "n", pch = c(19, 15),
155
+ cex.lab = 1.5, cex.axis = 1.5, cex.main = 1.5)
156
+ segments(seq(1:6), low, seq(1:6), high, lwd = 2, c(rep("black",2), rep("black",2), rep("black",2)))
157
+ Axis(side = 1, at = c(1, 2), labels = c("Sum", "Annual"), cex.axis = 1.5)
158
+ abline(h = 0, lty = 2)
159
+ mtext(side = 2, at = 0.5, "Prob (hate crime)", outer = TRUE, line = 0.5)
160
+ dev.off()
161
+
162
+ # ########################
163
+ # Figure C.8 in Appendix
164
+ # ########################
165
+
166
+ # Plot Effects
167
+ point_g <- c(bin_1_sum_gap$out_main[2], bin_1_p_gap$out_main[2])
168
+ high_g <- c(bin_1_sum_gap$out_main[3], bin_1_p_gap$out_main[3])
169
+ low_g <- c(bin_1_sum_gap$out_main[1], bin_1_p_gap$out_main[1])
170
+
171
+ ## Short Panel
172
+ marginal_list_g <- list()
173
+ marginal_list_g[[1]] <- bin_1_sum_gap_dose
174
+ marginal_list_g[[2]] <- bin_1_p_gap_dose
175
+
176
+ title_c <- c("Predicted Probability: Sum", "Predicted Probability: Annual")
177
+
178
+ # Plot Dose function
179
+
180
+ pdf("figure_C8.pdf", height = 4, width = 11)
181
+ par(mfrow = c(1,3), mar = c(4.5, 2, 4, 1), oma = c(0, 2, 0, 0))
182
+ for(i in 1:2){
183
+ plot_coef_all <- do.call("rbind", marginal_list_g[[i]]$out_main)
184
+ plot_x <- marginal_list_g[[i]]$treat_range
185
+ if(i <=1) ylim_u <- c(0.14, 0.22)
186
+ if(i > 1) ylim_u <- c(0.06, 0.11)
187
+
188
+ plot(plot_x, plot_coef_all[ ,2], pch = 19,
189
+ main = paste("", title_c[i], sep = ""),
190
+ ylim = ylim_u,
191
+ xlab = "Male Disadvantage",
192
+ ylab = "",
193
+ col = "black", cex = 2, type = "l", lwd = 3, cex.lab = 1.5, cex.axis = 1.5, cex.main = 1.5)
194
+ lines(plot_x, plot_coef_all[ ,1], col = "black", lty = 2)
195
+ lines(plot_x, plot_coef_all[ ,3], col = "black", lty = 2)
196
+ abline(h = marginal_list_g[[i]]$sample, lty = 2, col = "red", lwd = 2)
197
+ polygon(c(plot_x, rev(plot_x)), c(plot_coef_all[ ,1], rev(plot_coef_all[ ,3])),
198
+ col = adjustcolor("black", 0.2), border = NA)
199
+ par(new=TRUE)
200
+ hist(dat_2015_s$unemp_gendergap_2015, freq = FALSE,
201
+ breaks = seq(from = 0, to = 6, by = 0.01), xlim = c(min(plot_x), max(plot_x)),
202
+ xaxt = "n", yaxt = "n", xlab = "", ylab = "", ylim = c(0, 40), main ="")
203
+ }
204
+ par(mar = c(4.5, 5, 4, 1))
205
+ plot(seq(1:2), point_g, ylim = c(-0.01, 0.035),
206
+ ylab = "Effects on Prob (hate crime)",
207
+ main = "Effects of Male Disadvantage",
208
+ xlim = c(0.5, 2.5), xlab = "Outcome Types", xaxt = "n", pch = c(19, 15),
209
+ cex.lab = 1.5, cex.axis = 1.5, cex.main = 1.5)
210
+ segments(seq(1:6), low_g, seq(1:6), high_g, lwd = 2, c(rep("black",2), rep("black",2), rep("black",2)))
211
+ Axis(side = 1, at = c(1, 2), labels = c("Sum", "Annual"), cex.axis = 1.25)
212
+ abline(h = 0, lty = 2)
213
+ mtext(side = 2, at = 0.5, "Prob (hate crime)", outer = TRUE, line = 0.5)
214
+ dev.off()
32/replication_package/Help.R ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Help functions
2
+
3
+ marginal_effect <- function(out,
4
+ newdata=NULL,
5
+ main_var, family = "logit",
6
+ treat_range, difference = FALSE,
7
+ seed=1234){
8
+
9
+ fit <- out$fit
10
+ # Coef and VCOV
11
+ coef_mar <- coef(out$fit)[is.na(coef(out$fit)) == FALSE]
12
+ vcov_mar <- out$vcov
13
+
14
+ # Sample Mean of Outcomes
15
+ y_orig <- model.frame(formula(fit), data = newdata)[ ,1]
16
+ sample_mean_outcome <- mean(y_orig, na.rm = TRUE)
17
+
18
+ # Prepare model.frame and treat_range
19
+ newdata_use_b <- model.frame(formula(fit), data = newdata)
20
+ if(missing(treat_range)){
21
+ treat_range <- quantile(newdata_use_b[, main_var],
22
+ c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95),
23
+ na.rm = TRUE)
24
+ }
25
+
26
+ # Create new_treat and new_control automatically
27
+ newdata_use_l <- list()
28
+ for(i in 1:length(treat_range)){
29
+ newdata_use_l_b <- newdata_use_b
30
+ newdata_use_l_b[ , main_var] <- treat_range[i]
31
+ newdata_use_l_exp <- model.matrix(formula(fit), data = newdata_use_l_b)
32
+ newdata_use_l_exp <- newdata_use_l_exp[, names(coef_mar)]
33
+ newdata_use_l[[i]] <- newdata_use_l_exp
34
+ }
35
+
36
+ set.seed(seed)
37
+ sim_coef <- mvrnorm(n = 1000, mu=coef_mar, Sigma=vcov_mar)
38
+
39
+ # Linear Part
40
+ linear_out <- lapply(newdata_use_l,
41
+ FUN = function(x) as.matrix(sim_coef) %*% as.matrix(t(x)))
42
+
43
+
44
+ if(family %in% c("nb", "poisson")){
45
+ out <- lapply(linear_out, FUN = function(x) apply(exp(x), 1, mean))
46
+ }else if(family %in% c("ols")){
47
+ out <- lapply(linear_out, FUN = function(x) apply(x, 1, mean))
48
+ }else if(family %in% c("logit")){
49
+ out <- lapply(linear_out, FUN = function(x) apply((exp(x)/(1 + exp(x))), 1, mean))
50
+ }else{
51
+ warning("family should be one of 'nb', 'poisson', 'logit', and 'ols'")
52
+ }
53
+
54
+ if(difference == FALSE){
55
+ out_main <- lapply(out, FUN = function(x) c(quantile(x, c(0.025)), mean(x), quantile(x, c(0.975))))
56
+ names(out_main) <- treat_range
57
+ out_main_percent <- lapply(out,
58
+ FUN = function(x)
59
+ c(quantile(x, c(0.025)), mean(x), quantile(x, c(0.975)))/sample_mean_outcome)
60
+ names(out_main_percent) <- treat_range
61
+ }else if(difference == TRUE){
62
+ out_b <- out[[2]] - out[[1]]
63
+ out_main <- c(quantile(out_b, c(0.025)), mean(out_b), quantile(out_b, c(0.975)),
64
+ quantile(out_b, c(0.05)), quantile(out_b, c(0.95)))
65
+ out_main_percent <- out_main/sample_mean_outcome
66
+ }
67
+
68
+ output <- list("out" = out,
69
+ "out_main" = out_main,
70
+ "out_main_percent" = out_main_percent,
71
+ "sample_mean" = sample_mean_outcome,
72
+ "treat_range" = treat_range)
73
+ }
74
+
75
+ bin.summary <- function(formula, print_var, id, data, digits = 3, type = "logit"){
76
+ var <- all.vars(formula)
77
+ data_use <- model.frame( ~ ., data = data[, c(var, id)])
78
+
79
+ if(type == "logit") fit <- glm(formula, data = data_use, family = "binomial")
80
+ if(type == "probit") fit <- glm(formula, data = data_use, family = binomial(link="probit"))
81
+ tab_p <- coeftest(fit, vcov = vcovCL(fit, cluster = data_use[, id]))
82
+
83
+ if(missing(print_var)) print_var <- seq(1:min(20, nrow(tab_p)))
84
+
85
+ mat <- tab_p[print_var, ]
86
+
87
+ sig <- rep("", length(mat[,4]))
88
+ sig[mat[ , 4] < 0.001] <- "***"
89
+ sig[mat[ , 4] >= 0.001 & mat[ , 4] < 0.01] <- "**"
90
+ sig[mat[ , 4] >= 0.01 & mat[ , 4] < 0.05] <- "*"
91
+ sig[mat[ , 4] >= 0.05 & mat[ , 4] < 0.1] <- "."
92
+ mat <- as.data.frame(mat)
93
+ mat <- round(mat, digits = digits)
94
+ mat$Sig <- sig
95
+
96
+ sample_size <- length(fit$residuals)
97
+
98
+ cat("Coefficients:\n")
99
+ print(mat[, c(1, 2, 4, 5)], row.names=TRUE)
100
+ cat(paste("(Sample Size:", sample_size, ")\n", sep = ""))
101
+
102
+ output <- list("fit" = fit, "vcov" = vcovCL(fit, cluster = data_use[, id]),
103
+ "sample" = sample_size)
104
+
105
+ return(output)
106
+ }
107
+
108
+ lm.summary <- function(formula, print_var, id, data, digits = 3){
109
+ var <- all.vars(formula)
110
+ data_use <- model.frame( ~ ., data = data[, c(var, id)])
111
+
112
+ fit <- lm(formula, data = data_use)
113
+ tab_p <- coeftest(fit, vcov = vcovCL(fit, cluster = data_use[, id]))
114
+
115
+ if(missing(print_var)) print_var <- seq(1:min(20, nrow(tab_p)))
116
+
117
+ mat <- tab_p[print_var, ]
118
+
119
+ sig <- rep("", length(mat[,4]))
120
+ sig[mat[ , 4] < 0.001] <- "***"
121
+ sig[mat[ , 4] >= 0.001 & mat[ , 4] < 0.01] <- "**"
122
+ sig[mat[ , 4] >= 0.01 & mat[ , 4] < 0.05] <- "*"
123
+ sig[mat[ , 4] >= 0.05 & mat[ , 4] < 0.1] <- "."
124
+ mat <- as.data.frame(mat)
125
+ mat <- round(mat, digits = digits)
126
+ mat$Sig <- sig
127
+
128
+ sample_size <- length(fit$residuals)
129
+
130
+ cat("Coefficients:\n")
131
+ print(mat[, c(1, 2, 4, 5)], row.names=TRUE)
132
+ cat(paste("(Sample Size:", sample_size, ")\n", sep = ""))
133
+
134
+ output <- list("fit" = fit, "vcov" = vcovCL(fit, cluster = data_use[, id]),
135
+ "sample" = sample_size)
136
+
137
+ return(output)
138
+ }
139
+
140
+
141
+ glm.boot <- function(formula, data, family, cluster_id, boot = 1000, seed = 1234){
142
+
143
+ set.seed(seed)
144
+ data$cluster_id <- cluster_id
145
+
146
+ data_u <- data[is.na(data$cluster_id) == FALSE, ]
147
+ coef_boot <- c()
148
+ for(b in 1:boot){
149
+ boot_id <- sample(unique(data_u$cluster_id), size = length(unique(data_u$cluster_id)), replace=TRUE)
150
+ # create bootstap sample with sapply
151
+ boot_which <- sapply(boot_id, function(x) which(data_u$cluster_id == x))
152
+ data_boot <- data_u[unlist(boot_which),]
153
+ if(family == "poisson"){
154
+ glm_boot <- glm(formula, family = "poisson", data = data_boot)
155
+ coef_boot <- cbind(coef_boot, summary(glm_boot)$coef[,1])
156
+ }else if(family == "negative-binomial"){
157
+ glm_nb_boot <- glm.nb(formula, data = data_boot)
158
+ coef_boot <- cbind(coef_boot, summary(glm_nb_boot)$coef[,1])
159
+ }
160
+ if((b%%100) == 0) cat(paste(b, "..."))
161
+ }
162
+ if(family == "poisson"){
163
+ glm_boot_final <- glm(formula, family = "poisson", data = data)
164
+ }else if(family == "negative-binomial"){
165
+ glm_boot_final <- glm.nb(formula, data = data)
166
+ }
167
+ se <- apply(coef_boot, 1, sd) # bootstrap SE
168
+ coef <- glm_boot_final$coefficients
169
+
170
+ output <- list("fit" = glm_boot_final, "coef" = coef, "se" = se)
171
+
172
+ return(output)
173
+ }
174
+
175
+ star_out <- function(out, name){
176
+ writeLines(capture.output(out), name)
177
+ }
32/replication_package/SurveyAnalysis_Appendix.R ADDED
@@ -0,0 +1,810 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Replication File for Appendix: Survey Analysis
2
+ # Appendix D2 Figure D2: Replicate Figure 3 with only among anti-refugees
3
+ # Appendix D3 Figure D3: Variables Predicting Mate Competition vs. Other Views About Refugees
4
+ # Appendix D4 Figures D.4.1 and D.4.2: Replicate Figure 4 with wave 1
5
+ # Appendix D5 Table D.5: Table representation of Figure 5
6
+ # Appendix D6 Table D.6.1, Figure.6.2, Table.D.6.3, Table.D.6.4
7
+ # Appendix D8 Table D.8.1: Robustness Check with YouGov Survey Data
8
+
9
+ # R version 4.0.2 (2020-06-22)
10
+
11
+ # ##################
12
+ # Data Preparation
13
+ # ##################
14
+ rm(list=ls())
15
+ # install.packages("readstata13") # readstata13_0.9.2
16
+ # install.packages("MASS") # MASS_7.3-51.6
17
+ # install.packages("sandwich") # sandwich_2.5-1
18
+ # install.packages("lmtest") # lmtest_0.9-37
19
+ # install.packages("stargazer") # stargazer_5.2.2
20
+ # install.packages("foreign") # foreign_0.8-80
21
+ # install.packages("list") # list_9.2
22
+
23
+
24
+ require(readstata13) # readstata13_0.9.2
25
+ require(MASS) # MASS_7.3-51.6
26
+ require(sandwich) # sandwich_2.5-1
27
+ require(lmtest) # lmtest_0.9-37
28
+ require(stargazer) # stargazer_5.2.2
29
+ require(foreign) # foreign_0.8-80
30
+ require(list) # list_9.2
31
+ source("Help.R")
32
+
33
+ dat <- read.dta13(file = "survey.dta")
34
+
35
+ # Subset to people who pass the check
36
+ dat_use <- dat[dat$wave == 4, ]
37
+
38
+ ## ###############################
39
+ ## 1: Appendix D2 Figure D2
40
+ ## ###############################
41
+ # Replicate only among anti-refugee
42
+ quantile(dat_use$refugee_ind, probs = 0.75)
43
+
44
+ dat_use_r <- dat_use[dat_use$refugee_ind > 0.875, ]
45
+ dat_use_r$MateComp.cont_bin <- ifelse(dat_use_r$MateComp.cont >= 3, 1, 0)
46
+ dat_use_r$excess_c <- ifelse(dat_use_r$pop_15_44_muni_gendergap_2015 < 1.04, "1",
47
+ ifelse(dat_use_r$pop_15_44_muni_gendergap_2015 < 1.12, "2", "3"))
48
+ dat_male_r <- dat_use_r[dat_use_r$gender == "Male" & dat_use_r$age <= 44 & dat_use_r$age >= 18, ]
49
+ dat_male_y_r <- dat_use_r[dat_use_r$gender == "Male" & dat_use_r$age <= 40 & dat_use_r$age >= 30, ]
50
+
51
+ mean_all_r <- tapply(dat_use_r$MateComp.cont_bin, dat_use_r$excess_c, mean)
52
+ se_all_r <- tapply(dat_use_r$MateComp.cont_bin, dat_use_r$excess_c, sd)/sqrt(table(dat_use_r$excess_c))
53
+
54
+ mean_all_m_r <- tapply(dat_male_r$MateComp.cont_bin, dat_male_r$excess_c, mean)
55
+ se_all_m_r <- tapply(dat_male_r$MateComp.cont_bin, dat_male_r$excess_c, sd)/sqrt(table(dat_male_r$excess_c))
56
+
57
+ mean_all_y_r <- tapply(dat_male_y_r$MateComp.cont_bin, dat_male_y_r$excess_c, mean)
58
+ se_all_y_r <- tapply(dat_male_y_r$MateComp.cont_bin, dat_male_y_r$excess_c, sd)/sqrt(table(dat_male_y_r$excess_c))
59
+
60
+ pdf("figure_D2.pdf", height= 6, width = 17.5)
61
+ par(mfrow = c(1, 3), mar = c(2,2,3,2), oma = c(4,4,0,0))
62
+ plot(seq(1:3), mean_all_r, pch = 19, ylim = c(0, 1),
63
+ xlim = c(0.5, 3.5),
64
+ main = "All", xaxt = "n", xlab = "", ylab = "", cex.axis = 2.25, cex.main = 2.5,
65
+ cex = 2.25, cex.lab = 2.5)
66
+ segments(seq(1:3), mean_all_r - 1.96*se_all_r,
67
+ seq(1:3), mean_all_r + 1.96*se_all_r, pch = 19, lwd = 3)
68
+ Axis(side = 1, at = c(1,2,3), labels = c("1st tercile", "2nd tercile", "3rd tercile"), cex.axis = 2.25)
69
+
70
+ plot(seq(1:3), mean_all_m_r, pch = 19, ylim = c(0, 1),
71
+ xlim = c(0.5, 3.5),
72
+ main = "Male (18-44)", xaxt = "n", xlab = "", ylab = "", cex.axis = 2.25, cex.main = 2.5,
73
+ cex = 2.25, cex.lab = 2.5)
74
+ segments(seq(1:3), mean_all_m_r - 1.96*se_all_m_r,
75
+ seq(1:3), mean_all_m_r + 1.96*se_all_m_r, pch = 19, lwd = 3)
76
+ Axis(side = 1, at = c(1,2,3), labels = c("1st tercile", "2nd tercile", "3rd tercile"), cex.axis = 2.25)
77
+
78
+ plot(seq(1:3), mean_all_y_r, pch = 19, ylim = c(0, 1),
79
+ xlim = c(0.5, 3.5),
80
+ main = "Male (30 - 40)", xaxt = "n", xlab = "", ylab = "", cex.axis = 2.25, cex.main = 2.5,
81
+ cex = 2.25, cex.lab = 2.5)
82
+ segments(seq(1:3), mean_all_y_r - 1.96*se_all_y_r,
83
+ seq(1:3), mean_all_y_r + 1.96*se_all_y_r, pch = 19, lwd = 3)
84
+ Axis(side = 1, at = c(1,2,3), labels = c("1st tercile", "2nd tercile", "3rd tercile"), cex.axis = 2.25)
85
+ mtext("Proportion Perceiving Mate Competition", side = 2, outer = TRUE, at = 0.5,
86
+ cex = 1.5, line = 1.75)
87
+ mtext("Excess Males", side = 1, outer = TRUE, at = 0.175,
88
+ cex = 1.5, line = 1.75)
89
+ mtext("Excess Males", side = 1, outer = TRUE, at = 0.5,
90
+ cex = 1.5, line = 1.75)
91
+ mtext("Excess Males", side = 1, outer = TRUE, at = 0.825,
92
+ cex = 1.5, line = 1.75)
93
+ dev.off()
94
+
95
+
96
+ ## ###############################
97
+ ## 2: Appendix D3 Figure D3
98
+ ## ###############################
99
+ # Coefficients of Male x Single on Refugee Variables
100
+
101
+ rm(list=ls())
102
+ dat <- read.dta13(file = "survey.dta")
103
+ dat_use <- dat[dat$wave == 4, ]
104
+ source("Help.R")
105
+ dat_use$male <- as.numeric(dat_use$gender == "Male")
106
+
107
+ # outcomes we want to analyze
108
+ outcome_ref <- c("MateComp.cont", "JobComp.cont", "ref_integrating",
109
+ "ref_citizenship","ref_reduce","ref_moredone", "ref_cultgiveup",
110
+ "ref_economy", "ref_crime", "ref_terror", "ref_loc_services",
111
+ "ref_loc_economy", "ref_loc_crime", "ref_loc_culture",
112
+ "ref_loc_islam", "ref_loc_schools", "ref_loc_housing", "ref_loc_wayoflife")
113
+
114
+ outcome_ref_name <- c("Mate competition", "Job competition", "Integration",
115
+ "Citizenship for refugees","Number of refugees","More for refugees",
116
+ "Culture",
117
+ "Economy", "Crime", "Terrorism", "Local social services",
118
+ "Local economy", "Local crime", "Local culture",
119
+ "Islam", "Local school", "Housing", "Living")
120
+
121
+ # Fit Ordered Logit
122
+ lm_l <- list()
123
+ lm_out <- list()
124
+ male_mat <- sing_mat <- int_mat <- matrix(NA, nrow = 18, ncol = 2)
125
+ for(i in 1:18){
126
+ control <- paste(outcome_ref[-i], collapse = "+")
127
+ for_i <- paste("as.factor(", outcome_ref[i],")", "~ male*singdivsep + ", control, sep = "")
128
+ lm_l[[i]] <- polr(for_i, data = dat_use, Hess = TRUE)
129
+ lm_out[[i]] <- summary(lm_l[[i]])$coef
130
+ male_mat[i, 1:2] <- summary(lm_l[[i]])$coef["male", 1:2]
131
+ sing_mat[i, 1:2] <- summary(lm_l[[i]])$coef["singdivsep", 1:2]
132
+ int_mat[i, 1:2] <- summary(lm_l[[i]])$coef["male:singdivsep", 1:2]
133
+ }
134
+ rownames(int_mat) <- outcome_ref
135
+
136
+ # Fit linear regression
137
+ lm2_l <- list()
138
+ lm2_out <- list()
139
+ male_mat2 <- sing_mat2 <- int_mat2 <- matrix(NA, nrow = 18, ncol = 2)
140
+ for(i in 1:18){
141
+ control <- paste(outcome_ref[-i], collapse = "+")
142
+ for_i <- paste(outcome_ref[i], "~ male*singdivsep + ", control, sep = "")
143
+ lm2_l[[i]] <- lm(for_i, data = dat_use)
144
+ lm2_out[[i]] <- summary(lm2_l[[i]])$coef
145
+ male_mat2[i, 1:2] <- summary(lm2_l[[i]])$coef["male", 1:2]
146
+ sing_mat2[i, 1:2] <- summary(lm2_l[[i]])$coef["singdivsep", 1:2]
147
+ int_mat2[i, 1:2] <- summary(lm2_l[[i]])$coef["male:singdivsep", 1:2]
148
+ }
149
+ rownames(int_mat2) <- outcome_ref
150
+
151
+
152
+ # Show Coefficients for Male x Single Interaction (after controlling for other refugee variables)
153
+ # Both Ordered Logit and Linear regression
154
+ col_p <- rev(c("red", rep("black", 17)))
155
+
156
+ pdf("figure_D3_1.pdf", height = 6, width = 8)
157
+ par(mfrow = c(1, 2), mar = c(4, 2, 4, 1), oma = c(1, 10, 2, 2))
158
+ plot(rev(int_mat[,1]), seq(1:18), pch = 19, xlim = c(-0.6, 1.0), ylim = c(1, 18),
159
+ xlab = "Coefficients", ylab = "", yaxt = "n",
160
+ main = "Ordered logit", col = col_p)
161
+ segments(rev(int_mat[,1]) - 1.96*rev(int_mat[,2]), seq(1:18),
162
+ rev(int_mat[,1]) + 1.96*rev(int_mat[,2]), seq(1:18), col = col_p)
163
+ abline(v = 0, lty = 2)
164
+
165
+ plot(rev(int_mat2[,1]), seq(1:18), pch = 19, xlim = c(-0.3, 0.3), ylim = c(1, 18),
166
+ xlab = "Coefficients", ylab = "", yaxt = "n",
167
+ main = "Linear regression", col = col_p)
168
+ segments(rev(int_mat2[,1]) - 1.96*rev(int_mat2[,2]), seq(1:18),
169
+ rev(int_mat2[,1]) + 1.96*rev(int_mat2[,2]), seq(1:18), col = col_p)
170
+ abline(v = 0, lty = 2)
171
+
172
+ Axis(side = 2, at = seq(1:18), labels = rev(outcome_ref_name), las = 1, tick = 0,
173
+ outer = TRUE, hadj = 0, line = 7.5)
174
+ mtext(side = 3, at = 0.5, text = "Coefficients of Male x Single", cex = 1.5, font = 2, outer = TRUE)
175
+ dev.off()
176
+
177
+ # ######################################
178
+ # Coefficients of Women's Role on Mate Competition
179
+ # ######################################
180
+ # Ordered Logit
181
+ lm_l <- list()
182
+ lm_out <- list()
183
+ role_mat <- matrix(NA, nrow = 18, ncol = 2)
184
+ for(i in 1:18){
185
+ control <- paste(outcome_ref[-i], collapse = "+")
186
+ for_i <- paste("as.factor(", outcome_ref[i], ")", "~ women_role + ", control, sep = "")
187
+ lm_l[[i]] <- polr(for_i, data = dat_use, Hess = TRUE)
188
+ lm_out[[i]] <- summary(lm_l[[i]])$coef
189
+ role_mat[i, 1:2] <- summary(lm_l[[i]])$coef["women_role", 1:2]
190
+ }
191
+ rownames(role_mat) <- outcome_ref
192
+
193
+ # OLS
194
+ lm_l2 <- list()
195
+ lm_out2 <- list()
196
+ role_mat2 <- matrix(NA, nrow = 18, ncol = 2)
197
+ for(i in 1:18){
198
+ control <- paste(outcome_ref[-i], collapse = "+")
199
+ for_i <- paste(outcome_ref[i], "~ women_role + ", control, sep = "")
200
+ lm_l2[[i]] <- lm(for_i, data = dat_use)
201
+ lm_out2[[i]] <- summary(lm_l2[[i]])$coef
202
+ role_mat2[i, 1:2] <- summary(lm_l2[[i]])$coef["women_role", 1:2]
203
+ }
204
+ rownames(role_mat2) <- outcome_ref
205
+
206
+ pdf("figure_D3_2.pdf", height = 6, width = 8)
207
+ par(mfrow = c(1, 2), mar = c(4, 2, 4, 1), oma = c(1, 10, 2, 2))
208
+
209
+ plot(rev(role_mat[,1]), seq(1:18), pch = 19, xlim = c(-0.3, 0.6), ylim = c(1, 18),
210
+ xlab = "Coefficients", ylab = "", yaxt = "n",
211
+ main = "Ordered logit", col = col_p)
212
+ segments(rev(role_mat[,1]) - 1.96*rev(role_mat[,2]), seq(1:18),
213
+ rev(role_mat[,1]) + 1.96*rev(role_mat[,2]), seq(1:18), col = col_p)
214
+ abline(v = 0, lty = 2)
215
+
216
+ plot(rev(role_mat2[,1]), seq(1:18), pch = 19, xlim = c(-0.1, 0.15), ylim = c(1, 18),
217
+ xlab = "Coefficients", ylab = "", yaxt = "n",
218
+ main = "Linear regression", col = col_p)
219
+ segments(rev(role_mat2[,1]) - 1.96*rev(role_mat2[,2]), seq(1:18),
220
+ rev(role_mat2[,1]) + 1.96*rev(role_mat2[,2]), seq(1:18), col = col_p)
221
+ abline(v = 0, lty = 2)
222
+
223
+ Axis(side = 2, at = seq(1:18), labels = rev(outcome_ref_name), las = 1, tick = 0,
224
+ outer = TRUE, hadj = 0, line = 7.5)
225
+
226
+ mtext(side = 3, at = 0.5, text = "Coefficients of Women's Role",
227
+ cex = 1.5, font = 2, outer = TRUE)
228
+ dev.off()
229
+
230
+
231
+ ## ###################################
232
+ ## Appendix D4: Figure D.4.1 & D.4.2
233
+ ## ###################################
234
+ # Replicate Figure 3 with Wave 1
235
+ data.u1 <- dat[dat$wave == 1, ]
236
+
237
+ data.u1$List.treat <- ifelse(data.u1$treatment_list == "Scenario 2", 1, 0)
238
+
239
+ # Difference-in-Means (0.12618)
240
+ # Message (hate_pol_message):
241
+ # Attacks against refugee homes are sometimes necessary to make it clear to politicians that we have a refugee problem
242
+ diff.in.means.results <- ictreg(outcome_list ~ 1, data = data.u1,
243
+ treat = "List.treat", J = 3, method = "lm")
244
+ summary(diff.in.means.results)
245
+
246
+ data.u1$means_bin <- ifelse(data.u1$hate_violence_means >= 3, 1, 0)
247
+ data.u1$condemn_bin <- ifelse(data.u1$hate_polcondemn >= 3, 1, 0)
248
+ data.u1$justified_bin <- ifelse(data.u1$hate_justified >= 3, 1, 0)
249
+
250
+ only.mean <- mean(data.u1$means_bin)
251
+ condemn.mean <- mean(data.u1$condemn_bin)
252
+ justified.mean <- mean(data.u1$justified_bin)
253
+
254
+ only.se <- sd(data.u1$means_bin)/sqrt(length(data.u1$means_bin))
255
+ condemn.se <- sd(data.u1$condemn_bin)/sqrt(length(data.u1$condemn_bin))
256
+ justified.se <- sd(data.u1$justified_bin)/sqrt(length(data.u1$justified_bin))
257
+
258
+ # plot different questions within the same wave
259
+ point <- c(summary(diff.in.means.results)$par.treat, only.mean, condemn.mean, justified.mean)
260
+ se_p <- c(summary(diff.in.means.results)$se.treat, only.se, condemn.se, justified.se)
261
+ base <- barplot(point, ylim = c(0, 0.20))
262
+ bar_name_u <- c("Message (List)", "Only Means", "Condemn", "Justified")
263
+ bar_name <- rep("",4)
264
+
265
+ # Figure D.4.1
266
+ pdf("figure_D4_1.pdf", height = 4.5, width = 8)
267
+ par(mar = c(4, 5, 2, 1))
268
+ barplot(point, ylim = c(0, 0.3), names.arg = bar_name,
269
+ col = c(adjustcolor("red", 0.4), "gray", "gray", "gray"), cex.axis = 1.3)
270
+ arrows(base[,1], point - 1.96*se_p, base[,1], point + 1.96*se_p,
271
+ lwd = 3, angle = 90, length = 0.05, code = 3,
272
+ col = c("red", "black", "black", "black"))
273
+ mtext(bar_name_u[1], outer = FALSE, side = 1, at = base[1], cex = 1.2, line = 2.4)
274
+ mtext(bar_name_u[2], outer = FALSE, side = 1, at = base[2], cex = 1.2, line = 2.4)
275
+ mtext(bar_name_u[3], outer = FALSE, side = 1, at = base[3], cex = 1.2, line = 2.4)
276
+ mtext(bar_name_u[4], outer = FALSE, side = 1, at = base[4], cex = 1.2, line = 2.4)
277
+ text(x = base[1], y = 0.28, "Estimate from \nList Experiment", col = "red", font = 2)
278
+ text(x = base[3], y = 0.28, "Direct Questions", font = 2)
279
+ dev.off()
280
+
281
+ ## "Message" across Waves
282
+ data.u1 <- dat[dat$wave == 1, ]
283
+ data.u2 <- dat[dat$wave == 2, ]
284
+ data.u3 <- dat[dat$wave == 3, ]
285
+ data.u4 <- dat[dat$wave == 4, ]
286
+ dat_all <- rbind(data.u1, data.u2, data.u3, data.u4)
287
+
288
+ dat_all$hate_pol_message_bin <- ifelse(dat_all$hate_pol_message >=3, 1, 0)
289
+ message_direct <- tapply(dat_all$hate_pol_message_bin, dat_all$wave, mean, na.rm = TRUE)[c(2,3,4)]
290
+ message_direct_num <- tapply(dat_all$hate_pol_message_bin, dat_all$wave, function(x) sum(is.na(x)==FALSE))[c(2,3,4)]
291
+ message_direct_se <- tapply(dat_all$hate_pol_message_bin, dat_all$wave, sd, na.rm = TRUE)[c(2,3,4)]/sqrt(message_direct_num)
292
+
293
+ # plot The same question over time
294
+ point <- c(summary(diff.in.means.results)$par.treat, message_direct)
295
+ se_p <- c(summary(diff.in.means.results)$se.treat, message_direct_se)
296
+ base <- barplot(point, ylim = c(0, 0.20))
297
+ bar_name_u <- c("Message \n(List)", "Message \n(Direct, Wave 2)",
298
+ "Message \n(Direct, Wave 3)", "Message \n(Direct, Wave 4)")
299
+ bar_name <- rep("",4)
300
+
301
+ # Figure D.4.2
302
+ pdf("figure_D4_2.pdf", height = 4.5, width = 8)
303
+ par(mar = c(4, 5, 2, 1))
304
+ barplot(point, ylim = c(0, 0.25), names.arg = bar_name,
305
+ col = c(adjustcolor("red", 0.4), "gray", "gray", "gray"), cex.axis = 1.3,
306
+ ylab = "Proportion of respondents", cex.lab = 1.45)
307
+ arrows(base[,1], point - 1.96*se_p, base[,1], point + 1.96*se_p,
308
+ lwd = 3, angle = 90, length = 0.05, code = 3,
309
+ col = c("red", "black", "black", "black"))
310
+ mtext(bar_name_u[1], outer = FALSE, side = 1, at = base[1], cex = 1.2, line = 2.4)
311
+ mtext(bar_name_u[2], outer = FALSE, side = 1, at = base[2], cex = 1.2, line = 2.4)
312
+ mtext(bar_name_u[3], outer = FALSE, side = 1, at = base[3], cex = 1.2, line = 2.4)
313
+ mtext(bar_name_u[4], outer = FALSE, side = 1, at = base[4], cex = 1.2, line = 2.4)
314
+ text(x = base[1], y = 0.225, "Estimate from \nList Experiment", col = "red", font = 2)
315
+ text(x = base[3], y = 0.225, "Direct Questions", font = 2)
316
+ dev.off()
317
+
318
+
319
+ # #############################
320
+ # Appendix D5 Table D5
321
+ # #############################
322
+ formula.5 <-
323
+ as.character("hate_violence_means ~ MateComp.cont + JobComp.cont +
324
+ LifeSatis.cont + factor(age_group) + factor(gender) +
325
+ factor(state) + factor(citizenship) + factor(marital) +
326
+ factor(religion) + eduyrs + factor(occupation) +
327
+ factor(income) + factor(household_size) + factor(self_econ) +
328
+ factor(ref_integrating) + factor(ref_citizenship) + factor(ref_reduce) +
329
+ factor(ref_moredone) + factor(ref_cultgiveup) +
330
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror) +
331
+ factor(ref_loc_services) + factor(ref_loc_economy) + factor(ref_loc_crime) +
332
+ factor(ref_loc_culture) + factor(ref_loc_islam) +
333
+ factor(ref_loc_schools) + factor(ref_loc_housing) + factor(ref_loc_wayoflife)")
334
+
335
+ formula.6 <- paste(formula.5, "factor(distance_ref) + factor(settle_ref)",
336
+ "lrscale + afd + muslim_ind + afd_ind + contact_ind",
337
+ sep="+", collapse="+")
338
+
339
+ # with Difference Outcomes
340
+ # hate_pol_message : "82. Support for Hate Crime_Attacks against refugee homes are somet"
341
+ # hate_prevent_settlement : "82. Support for Hate Crime_Racist violence is defensible if it lea"
342
+ # hate_polcondemn : "82. Support for Hate Crime_Politicians should condemn attacks agai"
343
+ # hate_justified: "82. Support for Hate Crime_Hostility against foreigners is sometimes justified"
344
+
345
+ formula.7.means <- paste("hate_violence_means ~ ", as.character(as.formula(formula.6))[3], sep = "")
346
+ formula.7.message <- paste("hate_pol_message ~", as.character(as.formula(formula.6))[3], sep = "")
347
+ formula.7.prevent <- paste("hate_prevent_settlement ~", as.character(as.formula(formula.6))[3], sep = "")
348
+ formula.7.condemn <- paste("hate_polcondemn ~ ", as.character(as.formula(formula.6))[3], sep = "")
349
+ formula.7.justified <- paste("hate_justified ~ ", as.character(as.formula(formula.6))[3], sep = "")
350
+
351
+ # output
352
+ lm7.means <- lm(as.formula(formula.7.means), data=dat_use)
353
+ lm7.justified <- lm(as.formula(formula.7.justified), data=dat_use)
354
+ lm7.message <- lm(as.formula(formula.7.message), data=dat_use)
355
+ lm7.prevent <- lm(as.formula(formula.7.prevent), data=dat_use)
356
+ lm7.condemn <- lm(as.formula(formula.7.condemn), data=dat_use)
357
+
358
+ ## Table D.5 (in Appendix D.5)
359
+ lm.list_d <- list(lm7.means, lm7.justified, lm7.message, lm7.prevent, lm7.condemn)
360
+ star_out(stargazer(lm.list_d,
361
+ covariate.labels = c("Mate Competition","Job Competition","Life Satisfaction"),
362
+ keep=c("MateComp.cont","JobComp.cont","LifeSatis.cont")),
363
+ name = "table_D5_1.tex")
364
+
365
+ ## ##################################
366
+ ## Table D.5.2 (appendix) with East/West
367
+ ## ##################################
368
+ rm(list=ls())
369
+ # Set the directly appropriately
370
+
371
+ dat <- read.dta13(file = "survey.dta")
372
+ source("Help.R")
373
+
374
+ # Subset to wave 4
375
+ dat_use <- dat[dat$wave == 4, ]
376
+ {
377
+ dat_use$west <- 1 - dat_use$east
378
+
379
+ # remove state
380
+ formula.5_int <-
381
+ as.character("hate_violence_means ~ MateComp.cont*west + JobComp.cont +
382
+ LifeSatis.cont + factor(age_group) + factor(gender) +
383
+ factor(citizenship) + factor(marital) +
384
+ factor(religion) + eduyrs + factor(occupation) +
385
+ factor(income) + factor(household_size) + factor(self_econ) +
386
+ factor(ref_integrating) + factor(ref_citizenship) + factor(ref_reduce) +
387
+ factor(ref_moredone) + factor(ref_cultgiveup) +
388
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror) +
389
+ factor(ref_loc_services) + factor(ref_loc_economy) + factor(ref_loc_crime) +
390
+ factor(ref_loc_culture) + factor(ref_loc_islam) +
391
+ factor(ref_loc_schools) + factor(ref_loc_housing) + factor(ref_loc_wayoflife)")
392
+
393
+ formula.6_int <- paste(formula.5_int, "factor(distance_ref) + factor(settle_ref)",
394
+ "lrscale + afd + muslim_ind + afd_ind + contact_ind",
395
+ sep="+", collapse="+")
396
+
397
+ ## Interaction with East/West
398
+ # with Difference Outcomes
399
+ # hate_pol_message: "82. Support for Hate Crime_Attacks against refugee homes are somet"
400
+ # hate_prevent_settlement: "82. Support for Hate Crime_Racist violence is defensible if it lea"
401
+ # hate_polcondemn: "82. Support for Hate Crime_Politicians should condemn attacks agai"
402
+ # hate_justified: "82. Support for Hate Crime_Hostility against foreigners is sometimes justified"
403
+
404
+ formula.7_int.means <- paste("hate_violence_means ~ ",
405
+ as.character(as.formula(formula.6_int))[3], sep = "")
406
+ formula.7_int.message <- paste("hate_pol_message ~",
407
+ as.character(as.formula(formula.6_int))[3], sep = "")
408
+ formula.7_int.prevent <- paste("hate_prevent_settlement ~",
409
+ as.character(as.formula(formula.6_int))[3], sep = "")
410
+ formula.7_int.condemn <- paste("hate_polcondemn ~ ",
411
+ as.character(as.formula(formula.6_int))[3], sep = "")
412
+ formula.7_int.justified <- paste("hate_justified ~ ",
413
+ as.character(as.formula(formula.6_int))[3], sep = "")
414
+
415
+ # output
416
+ lm7_int.means <- lm(as.formula(formula.7_int.means), data = dat_use)
417
+ lm7_int.justified <- lm(as.formula(formula.7_int.justified), data=dat_use)
418
+ lm7_int.message <- lm(as.formula(formula.7_int.message), data=dat_use)
419
+ lm7_int.prevent <- lm(as.formula(formula.7_int.prevent), data=dat_use)
420
+ lm7_int.condemn <- lm(as.formula(formula.7_int.condemn), data=dat_use)
421
+
422
+ ## Table D.5.2 (in Appendix D.5)
423
+ lm.list_int <- list(lm7_int.means, lm7_int.justified, lm7_int.message, lm7_int.prevent, lm7_int.condemn)
424
+ star_out(stargazer(lm.list_int,
425
+ covariate.labels = c("Mate Competition",
426
+ "West",
427
+ "Job Competition","Life Satisfaction",
428
+ "Mate Competition x West"),
429
+ keep=c("MateComp.cont", "west",
430
+ "JobComp.cont","LifeSatis.cont",
431
+ "MateComp.cont:west")),
432
+ name = "table_D5_2.tex")
433
+ }
434
+
435
+ # ##########################################
436
+ # Appendix D6: Replcate Results with Men
437
+ # ##########################################
438
+ rm(list=ls())
439
+ # Set the directly appropriately
440
+
441
+ dat <- read.dta13(file = "survey.dta")
442
+ source("Help.R")
443
+
444
+ # Subset to wave 4
445
+ dat_use <- dat[dat$wave == 4, ]
446
+ dat_male <- dat_use[dat_use$gender == "Male",]
447
+ dat_female <- dat_use[dat_use$gender == "Female",]
448
+
449
+ # ##########################################
450
+ # Table D.6.1: Replicate Main Models
451
+ # ##########################################
452
+ {
453
+
454
+ lm1 <- lm(hate_violence_means ~ MateComp.cont, data=dat_male)
455
+
456
+ lm2 <- lm(hate_violence_means ~ MateComp.cont + JobComp.cont + LifeSatis.cont, data=dat_male)
457
+
458
+ lm3 <- lm(hate_violence_means ~ MateComp.cont + JobComp.cont + LifeSatis.cont +
459
+ factor(age_group) + # age group
460
+ factor(state) + # state
461
+ factor(citizenship) + # german citizen
462
+ factor(marital) + # marital status
463
+ factor(religion) + # religious affiliation
464
+ eduyrs + # education
465
+ factor(occupation) + # main activity
466
+ factor(income) + # income
467
+ factor(household_size) + # household size
468
+ factor(self_econ), # subjective social status
469
+ data=dat_male)
470
+
471
+ lm4 <- lm(hate_violence_means ~ MateComp.cont + JobComp.cont + LifeSatis.cont +
472
+ factor(age_group) + # age group
473
+ factor(state) + # state
474
+ factor(citizenship) + # german citizen
475
+ factor(marital) + # marital status
476
+ factor(religion) + # religious affiliation
477
+ eduyrs + # education
478
+ factor(occupation) + # main activity
479
+ factor(income) + # income
480
+ factor(household_size) + # household size
481
+ factor(self_econ) + # subjective social status
482
+ factor(ref_integrating) + # Refugee Index (National-level; Q73) 8 in total
483
+ factor(ref_citizenship) + factor(ref_reduce) + factor(ref_moredone) + factor(ref_cultgiveup) +
484
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror),
485
+ data=dat_male)
486
+
487
+ lm5 <- lm(hate_violence_means ~ MateComp.cont + JobComp.cont + LifeSatis.cont +
488
+ factor(age_group) + # age group
489
+ factor(state) + # state
490
+ factor(citizenship) + # german citizen
491
+ factor(marital) + # marital status
492
+ factor(religion) + # religious affiliation
493
+ eduyrs + # education
494
+ factor(occupation) + # main activity
495
+ factor(income) + # income
496
+ factor(household_size) + # household size
497
+ factor(self_econ) + # subjective social status
498
+ factor(ref_integrating) + # Refugee Index (National-level; Q73) 8 in total
499
+ factor(ref_citizenship) + factor(ref_reduce) + factor(ref_moredone) + factor(ref_cultgiveup) +
500
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror) +
501
+ factor(ref_loc_services) + # Refugee Index (Local, Q75)
502
+ factor(ref_loc_economy) + factor(ref_loc_crime) + factor(ref_loc_culture) + factor(ref_loc_islam) +
503
+ factor(ref_loc_schools) + factor(ref_loc_housing) + factor(ref_loc_wayoflife), ## end
504
+ data=dat_male)
505
+
506
+
507
+ # Add More Variables
508
+ # lrscale Q21 Left-Right Scale
509
+ # afd, Q23 Closeness to AfD
510
+ # muslim_ind, afd_ind, contact_ind
511
+ # distance_ref Q71. Distance to refugee reception centers
512
+ # settle_ref Q72. Settlement of refugees living in area
513
+
514
+ formula.5 <-
515
+ as.character("hate_violence_means ~ MateComp.cont + JobComp.cont +
516
+ LifeSatis.cont + factor(age_group) +
517
+ factor(state) + factor(citizenship) + factor(marital) +
518
+ factor(religion) + eduyrs + factor(occupation) +
519
+ factor(income) + factor(household_size) + factor(self_econ) +
520
+ factor(ref_integrating) + factor(ref_citizenship) + factor(ref_reduce) +
521
+ factor(ref_moredone) + factor(ref_cultgiveup) +
522
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror) +
523
+ factor(ref_loc_services) + factor(ref_loc_economy) + factor(ref_loc_crime) +
524
+ factor(ref_loc_culture) + factor(ref_loc_islam) +
525
+ factor(ref_loc_schools) + factor(ref_loc_housing) + factor(ref_loc_wayoflife)")
526
+
527
+ formula.6 <- paste(formula.5, "factor(distance_ref) + factor(settle_ref)",
528
+ "lrscale + afd + muslim_ind + afd_ind + contact_ind",
529
+ sep="+", collapse="+")
530
+
531
+ lm6 <- lm(as.formula(formula.6), data=dat_male)
532
+ }
533
+ lm.list.table1 <- list(lm1, lm2, lm3, lm4, lm5, lm6)
534
+
535
+ # Table D.6.1
536
+ star_out(stargazer(lm.list.table1,
537
+ covariate.labels = c("Mate Competition","Job Competition","Life Satisfaction"),
538
+ keep=c("MateComp.cont","JobComp.cont","LifeSatis.cont")),
539
+ name = "table_D6_1.tex")
540
+
541
+ ## ###############################################
542
+ ## Figure D.6.2: Replicating Figure 4 (with Male)
543
+ ## ###############################################
544
+ # with Difference Outcomes
545
+ # hate_pol_message: "82. Support for Hate Crime_Attacks against refugee homes are somet"
546
+ # hate_prevent_settlement: "82. Support for Hate Crime_Racist violence is defensible if it lea"
547
+ # hate_polcondemn: "82. Support for Hate Crime_Politicians should condemn attacks agai"
548
+ # hate_justified: "82. Support for Hate Crime_Hostility against foreigners is sometimes justified"
549
+
550
+ # without gender
551
+ formula.5 <-
552
+ as.character("hate_violence_means ~ MateComp.cont + JobComp.cont +
553
+ LifeSatis.cont + factor(age_group) +
554
+ factor(state) + factor(citizenship) + factor(marital) +
555
+ factor(religion) + eduyrs + factor(occupation) +
556
+ factor(income) + factor(household_size) + factor(self_econ) +
557
+ factor(ref_integrating) + factor(ref_citizenship) + factor(ref_reduce) +
558
+ factor(ref_moredone) + factor(ref_cultgiveup) +
559
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror) +
560
+ factor(ref_loc_services) + factor(ref_loc_economy) + factor(ref_loc_crime) +
561
+ factor(ref_loc_culture) + factor(ref_loc_islam) +
562
+ factor(ref_loc_schools) + factor(ref_loc_housing) + factor(ref_loc_wayoflife)")
563
+
564
+ formula.6 <- paste(formula.5, "factor(distance_ref) + factor(settle_ref)",
565
+ "lrscale + afd + muslim_ind + afd_ind + contact_ind",
566
+ sep="+", collapse="+")
567
+
568
+ formula.7.means <- paste("hate_violence_means ~ ", as.character(as.formula(formula.6))[3], sep = "")
569
+ formula.7.message <- paste("hate_pol_message ~", as.character(as.formula(formula.6))[3], sep = "")
570
+ formula.7.prevent <- paste("hate_prevent_settlement ~", as.character(as.formula(formula.6))[3], sep = "")
571
+ formula.7.condemn <- paste("hate_polcondemn ~ ", as.character(as.formula(formula.6))[3], sep = "")
572
+ formula.7.justified <- paste("hate_justified ~ ", as.character(as.formula(formula.6))[3], sep = "")
573
+
574
+ # output
575
+ lm7.means <- lm(as.formula(formula.7.means), data=dat_male)
576
+ lm7.justified <- lm(as.formula(formula.7.justified), data=dat_male)
577
+ lm7.message <- lm(as.formula(formula.7.message), data=dat_male)
578
+ lm7.prevent <- lm(as.formula(formula.7.prevent), data=dat_male)
579
+ lm7.condemn <- lm(as.formula(formula.7.condemn), data=dat_male)
580
+
581
+ point <- c(coef(lm7.means)["MateComp.cont"],
582
+ coef(lm7.justified)["MateComp.cont"], coef(lm7.message)["MateComp.cont"],
583
+ coef(lm7.prevent)["MateComp.cont"], coef(lm7.condemn)["MateComp.cont"])
584
+
585
+ se <- c(summary(lm7.means)$coef["MateComp.cont", 2],
586
+ summary(lm7.justified)$coef["MateComp.cont", 2], summary(lm7.message)$coef["MateComp.cont", 2],
587
+ summary(lm7.prevent)$coef["MateComp.cont", 2], summary(lm7.condemn)$coef["MateComp.cont", 2])
588
+
589
+
590
+ pdf("figure_D6_2.pdf", height = 4, width = 8)
591
+ par(mar = c(2,4,4,1))
592
+ plot(seq(1:5), point, pch = 19, ylim = c(-0.05, 0.25), xlim = c(0.5, 5.5),
593
+ xlab = "", xaxt = "n", ylab = "Estimated Effects",
594
+ main = "Estimated Effects of Mate Competition (among male)", cex.lab = 1.25, cex.axis = 1.25, cex.main = 1.5)
595
+ segments(seq(1:5), point - 1.96*se,
596
+ seq(1:5), point + 1.96*se, lwd = 2)
597
+ Axis(side=1, at = seq(1:5), labels = c("Only Means", "Justified", "Message",
598
+ "Prevent", "Condemn"), cex.axis = 1.25)
599
+ abline(h =0, lty = 2)
600
+ dev.off()
601
+
602
+ ## Table D.6.3
603
+ lm.list_d_m <- list(lm7.means, lm7.justified, lm7.message, lm7.prevent, lm7.condemn)
604
+ star_out(stargazer(lm.list_d_m,
605
+ covariate.labels = c("Mate Competition","Job Competition","Life Satisfaction"),
606
+ keep=c("MateComp.cont","JobComp.cont","LifeSatis.cont")),
607
+ name = "table_D6_3.tex")
608
+
609
+ # ##########################################
610
+ # Appendix D8, Table D8: YouGov analysis
611
+ # ##########################################
612
+ rm(list=ls())
613
+ you_data <- read.dta13(file = "YouGov.dta")
614
+ source("Help.R")
615
+
616
+ ## (1) Main Regression
617
+ lm1 <- lm(hate_cont ~ mate_compete +
618
+ age + # age
619
+ gender + # gender
620
+ factor(sta) + #state
621
+ factor(mstat) + # Marital Status
622
+ reli + # religion
623
+ educ_aggr_rec + # education
624
+ hinc + # income
625
+ housz + # household size
626
+ pol_leftright, # leftright scale
627
+ data = you_data)
628
+ summary(lm1)
629
+
630
+ ## (2) + Aggression Score
631
+ lm2 <- lm(hate_cont ~
632
+ mate_compete +
633
+ age + # age
634
+ gender + # gender
635
+ factor(sta) + #state
636
+ factor(mstat) + # Marital Status
637
+ reli + # religion
638
+ educ_aggr_rec + # education
639
+ hinc + # income
640
+ housz + # household size
641
+ pol_leftright + # leftright scale
642
+ angry_mean, # aggression score
643
+ data = you_data)
644
+ summary(lm2)
645
+
646
+ ## (3) + Refugee Index
647
+ lm3 <- lm(hate_cont ~
648
+ mate_compete +
649
+ age + # age
650
+ gender + # gender
651
+ factor(sta) + #state
652
+ factor(mstat) + # Marital Status
653
+ reli + # religion
654
+ educ_aggr_rec + # education
655
+ hinc + # income
656
+ housz + # household size
657
+ pol_leftright + # leftright scale
658
+ angry_mean + # aggression score
659
+ ref_loc_services + ref_loc_economy + ref_loc_crime + ## Refugee Questions (9 Questions)
660
+ ref_loc_culture + ref_loc_islam + ref_local_job +
661
+ ref_loc_schools + ref_loc_housing + ref_loc_wayoflife,
662
+ data = you_data)
663
+ summary(lm3)
664
+
665
+ ## (4) + Refugee Contact
666
+ lm4 <- lm(hate_cont ~
667
+ mate_compete +
668
+ age + # age
669
+ gender + # gender
670
+ factor(sta) + #state
671
+ factor(mstat) + # Marital Status
672
+ reli + # religion
673
+ educ_aggr_rec + # education
674
+ hinc + # income
675
+ housz + # household size
676
+ pol_leftright + # leftright scale
677
+ angry_mean + # aggression score
678
+ ref_loc_services + ref_loc_economy + ref_loc_crime + ## Refugee Questions (9 Questions)
679
+ ref_loc_culture + ref_loc_islam + ref_local_job +
680
+ ref_loc_schools + ref_loc_housing + ref_loc_wayoflife +
681
+ see_ref_road + see_ref_store + see_ref_center + ## Refugee Contact (5 Questions)
682
+ see_ref_school + see_ref_work,
683
+ data = you_data)
684
+ summary(lm4)
685
+
686
+ ## (5) + AfD Score
687
+ lm5 <- lm(hate_cont ~
688
+ mate_compete +
689
+ age + # age
690
+ gender + # gender
691
+ factor(sta) + #state
692
+ factor(mstat) + # Marital Status
693
+ reli + # religion
694
+ educ_aggr_rec + # education
695
+ hinc + # income
696
+ housz + # household size
697
+ pol_leftright + # leftright scale
698
+ angry_mean + # aggression score
699
+ ref_loc_services + ref_loc_economy + ref_loc_crime + ## Refugee Questions (9 Questions)
700
+ ref_loc_culture + ref_loc_islam + ref_local_job +
701
+ ref_loc_schools + ref_loc_housing + ref_loc_wayoflife +
702
+ see_ref_road + see_ref_store + see_ref_center + ## Refugee Contact (5 Questions)
703
+ see_ref_school + see_ref_work +
704
+ afd.score, # Closeness to AfD
705
+ data = you_data)
706
+ summary(lm5)
707
+
708
+ star_out(stargazer(list(lm1, lm2, lm3, lm4, lm5),
709
+ covariate.labels = c("Mate Competition", "Aggressiveness"), keep=c("mate_compete", "angry_mean")),
710
+ name = "table_D8_1.tex")
711
+
712
+
713
+ rm(list=ls())
714
+ you_data <- read.dta13(file = "YouGov.dta")
715
+ you_male <- you_data[you_data$gender == levels(you_data$gender)[1], ]
716
+ source("Help.R")
717
+
718
+ {
719
+ ## (1) Main Regression
720
+ lm1 <- lm(hate_cont ~ mate_compete +
721
+ age + # age
722
+ factor(sta) + #state
723
+ factor(mstat) + # Marital Status
724
+ reli + # religion
725
+ educ_aggr_rec + # education
726
+ hinc + # income
727
+ housz + # household size
728
+ pol_leftright, # leftright scale
729
+ data = you_male)
730
+
731
+ ## (2) + Aggression Score
732
+ lm2 <- lm(hate_cont ~
733
+ mate_compete +
734
+ age + # age
735
+ factor(sta) + #state
736
+ factor(mstat) + # Marital Status
737
+ reli + # religion
738
+ educ_aggr_rec + # education
739
+ hinc + # income
740
+ housz + # household size
741
+ pol_leftright + # leftright scale
742
+ angry_mean, # aggression score
743
+ data = you_male)
744
+
745
+ ## (3) + Refugee Index
746
+ lm3 <- lm(hate_cont ~
747
+ mate_compete +
748
+ age + # age
749
+ factor(sta) + #state
750
+ factor(mstat) + # Marital Status
751
+ reli + # religion
752
+ educ_aggr_rec + # education
753
+ hinc + # income
754
+ housz + # household size
755
+ pol_leftright + # leftright scale
756
+ angry_mean + # aggression score
757
+ ref_loc_services + ref_loc_economy + ref_loc_crime + ## Refugee Questions (9 Questions)
758
+ ref_loc_culture + ref_loc_islam + ref_local_job +
759
+ ref_loc_schools + ref_loc_housing + ref_loc_wayoflife,
760
+ data = you_male)
761
+ summary(lm3)
762
+
763
+ ## (4) + Refugee Contact
764
+ lm4 <- lm(hate_cont ~
765
+ mate_compete +
766
+ age + # age
767
+ # gender + # gender
768
+ factor(sta) + #state
769
+ factor(mstat) + # Marital Status
770
+ reli + # religion
771
+ educ_aggr_rec + # education
772
+ hinc + # income
773
+ housz + # household size
774
+ pol_leftright + # leftright scale
775
+ angry_mean + # aggression score
776
+ ref_loc_services + ref_loc_economy + ref_loc_crime + ## Refugee Questions (9 Questions)
777
+ ref_loc_culture + ref_loc_islam + ref_local_job +
778
+ ref_loc_schools + ref_loc_housing + ref_loc_wayoflife +
779
+ see_ref_road + see_ref_store + see_ref_center + ## Refugee Contact (5 Questions)
780
+ see_ref_school + see_ref_work,
781
+ data = you_male)
782
+ summary(lm4)
783
+
784
+ ## (5) + AfD Score
785
+ lm5 <- lm(hate_cont ~
786
+ mate_compete +
787
+ age + # age
788
+ # gender + # gender
789
+ factor(sta) + #state
790
+ factor(mstat) + # Marital Status
791
+ reli + # religion
792
+ educ_aggr_rec + # education
793
+ hinc + # income
794
+ housz + # household size
795
+ pol_leftright + # leftright scale
796
+ angry_mean + # aggression score
797
+ ref_loc_services + ref_loc_economy + ref_loc_crime + ## Refugee Questions (9 Questions)
798
+ ref_loc_culture + ref_loc_islam + ref_local_job +
799
+ ref_loc_schools + ref_loc_housing + ref_loc_wayoflife +
800
+ see_ref_road + see_ref_store + see_ref_center + ## Refugee Contact (5 Questions)
801
+ see_ref_school + see_ref_work +
802
+ afd.score, # Closeness to AfD
803
+ data = you_male)
804
+ summary(lm5)
805
+ }
806
+
807
+ star_out(stargazer(list(lm1, lm2, lm3, lm4, lm5),
808
+ covariate.labels = c("Mate Competition", "Aggressiveness"),
809
+ keep=c("mate_compete", "angry_mean")),
810
+ name = "table_D8_2.tex")
32/replication_package/SurveyAnalysis_Main.R ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Replication File for Survey Analysis
2
+ # Figure 2: Individuals Living in Municipalities with a Higher Degree ofExcess MalesPerceiveMore Mate Competition
3
+ # Figure 3: List Experiment
4
+ # Table 1: Mate Competition Predicts Support for Hate Crime
5
+ # Figure 4: Estimated Effects of Mate Competition on Support for Hate Crimes
6
+
7
+ # R version 4.0.2 (2020-06-22)
8
+
9
+ # ##################
10
+ # Data Preparation
11
+ # ##################
12
+ rm(list=ls())
13
+ # Set the directly appropriately
14
+
15
+ # install.packages("readstata13") # readstata13_0.9.2
16
+ # install.packages("MASS") # MASS_7.3-51.6
17
+ # install.packages("sandwich") # sandwich_2.5-1
18
+ # install.packages("lmtest") # lmtest_0.9-37
19
+ # install.packages("pBrackets") # pBrackets_1.0
20
+ # install.packages("stargazer") # stargazer_5.2.2
21
+
22
+
23
+ require(readstata13) # readstata13_0.9.2
24
+ require(MASS) # MASS_7.3-51.6
25
+ require(sandwich) # sandwich_2.5-1
26
+ require(lmtest) # lmtest_0.9-37
27
+ require(pBrackets) # pBrackets_1.0
28
+ require(stargazer) # stargazer_5.2.2
29
+ source("Help.R")
30
+
31
+ dat <- read.dta13(file = "survey.dta")
32
+
33
+ # Subset to people in the wave 4
34
+ dat_use <- dat[dat$wave == 4, ]
35
+
36
+ # #######################
37
+ # Figure 2
38
+ # #######################
39
+ # Prepare Two data sets
40
+ dat_male <- dat_use[dat_use$gender == "Male" & dat_use$age <= 44 & dat_use$age >= 18, ]
41
+ dat_male_y <- dat_use[dat_use$gender == "Male" & dat_use$age <= 40 & dat_use$age >= 30, ]
42
+
43
+ # Overall Samples
44
+ dat_use$MateComp.cont_bin <- ifelse(dat_use$MateComp.cont >= 3, 1, 0)
45
+ dat_use$excess_c <- ifelse(dat_use$pop_15_44_muni_gendergap_2015 < 1.04, "1",
46
+ ifelse(dat_use$pop_15_44_muni_gendergap_2015 < 1.12, "2", "3"))
47
+ mean_all <- tapply(dat_use$MateComp.cont_bin, dat_use$excess_c, mean)
48
+ se_all <- tapply(dat_use$MateComp.cont_bin, dat_use$excess_c, sd)/sqrt(table(dat_use$excess_c))
49
+
50
+ # Male (18 - 44)
51
+ dat_male$MateComp.cont_bin <- ifelse(dat_male$MateComp.cont >= 3, 1, 0)
52
+ dat_male$excess_c <- ifelse(dat_male$pop_15_44_muni_gendergap_2015 < 1.04, "1",
53
+ ifelse(dat_male$pop_15_44_muni_gendergap_2015 < 1.12, "2", "3"))
54
+ mean_all_m <- tapply(dat_male$MateComp.cont_bin, dat_male$excess_c, mean)
55
+ se_all_m <- tapply(dat_male$MateComp.cont_bin, dat_male$excess_c, sd)/sqrt(table(dat_male$excess_c))
56
+
57
+ # Male (30 - 40)
58
+ dat_male_y$MateComp.cont_bin <- ifelse(dat_male_y$MateComp.cont >= 3, 1, 0)
59
+ dat_male_y$excess_c <- ifelse(dat_male_y$pop_15_44_muni_gendergap_2015 < 1.04, "1",
60
+ ifelse(dat_male_y$pop_15_44_muni_gendergap_2015 < 1.12, "2", "3"))
61
+ mean_all_y <- tapply(dat_male_y$MateComp.cont_bin, dat_male_y$excess_c, mean)
62
+ se_all_y <- tapply(dat_male_y$MateComp.cont_bin, dat_male_y$excess_c, sd)/sqrt(table(dat_male_y$excess_c))
63
+
64
+
65
+ mean_all ## 0.1835004 0.1970803 0.2244489
66
+ mean_all_m ## 0.2282609 0.2745902 0.3750000
67
+ mean_all_y ## 0.1743119 0.2818182 0.4705882
68
+
69
+ {
70
+ diff <- c(mean_all[2] - mean_all[1],
71
+ mean_all[3] - mean_all[2],
72
+ mean_all[3] - mean_all[1])
73
+ sd_d <- c(sqrt(se_all[2]^2 + se_all[1]^2),
74
+ sqrt(se_all[3]^2 + se_all[2]^2),
75
+ sqrt(se_all[3]^2 + se_all[1]^2))
76
+ diff_m <- c(mean_all_m[2] - mean_all_m[1],
77
+ mean_all_m[3] - mean_all_m[2],
78
+ mean_all_m[3] - mean_all_m[1])
79
+ sd_d_m <- c(sqrt(se_all_m[2]^2 + se_all_m[1]^2),
80
+ sqrt(se_all_m[3]^2 + se_all_m[2]^2),
81
+ sqrt(se_all_m[3]^2 + se_all_m[1]^2))
82
+ diff_y <- c(mean_all_y[2] - mean_all_y[1],
83
+ mean_all_y[3] - mean_all_y[2],
84
+ mean_all_y[3] - mean_all_y[1])
85
+ sd_d_y <- c(sqrt(se_all_y[2]^2 + se_all_y[1]^2),
86
+ sqrt(se_all_y[3]^2 + se_all_y[2]^2),
87
+ sqrt(se_all_y[3]^2 + se_all_y[1]^2))
88
+
89
+
90
+ diff_l <- c(diff, diff_m, diff_y)
91
+ se_l <- c(sd_d, sd_d_m, sd_d_y)
92
+ p_value <- 2*(1 - pnorm(abs(diff_l/se_l)))
93
+ diff_table <- cbind(diff_l, se_l, p_value)
94
+ }
95
+
96
+ pdf("figure_2.pdf", height= 15.5, width = 6.5)
97
+ par(mfrow = c(3, 1), mar = c(6,5,5,2), oma = c(0,4,0,0))
98
+ plot(seq(1:3), mean_all, pch = 19, ylim = c(0.1,0.4),
99
+ xlim = c(0.5, 3.5),
100
+ main = "All", xaxt = "n", xlab = "", ylab = "",
101
+ cex.axis = 2.25, cex.main = 2.5, yaxt = "n",
102
+ cex = 2.25, cex.lab = 2.5)
103
+ segments(seq(1:3), mean_all - 1.96*se_all,
104
+ seq(1:3), mean_all + 1.96*se_all, pch = 19, lwd = 3)
105
+ Axis(side = 1, at = c(1,2,3), labels = c("1st tercile", "2nd tercile", "3rd tercile"), cex.axis = 2.25)
106
+ Axis(side = 2, at = c(0.1,0.2,0.3, 0.4), labels = c("0.1", "0.2", "0.3", "0.4"), cex.axis = 2.25)
107
+ brackets(x1 = 1.1, y1 = 0.3, x2 = 1.9, y2 = 0.3, h = 0.01, type = 4)
108
+ brackets(x1 = 2.1, y1 = 0.3, x2 = 2.9, y2 = 0.3, h = 0.01, type = 4)
109
+ brackets(x1 = 1, y1 = 0.37, x2 = 3, y2 = 0.37, h = 0.01, type = 4)
110
+ # text(x = 1.5, y = 0.33, paste0("pv = ", round(p_value[1],digits=3)), cex = 1.95)
111
+ text(x = 1.5, y = 0.33, paste0("pv = 0.40"), cex = 1.95)
112
+ text(x = 2.5, y = 0.33, paste0("pv = ", round(p_value[2],2)), cex = 1.95)
113
+ text(x = 2, y = 0.40, paste0("pv = ", round(p_value[3],2)), cex = 1.95)
114
+ mtext("Excess Males", side = 1, cex = 1.75, line = 3.75)
115
+ mtext("Proportion Perceiving\nMate Competition", side = 2, cex = 1.75, line = 3.75)
116
+
117
+ plot(seq(1:3), mean_all_m, pch = 19, ylim = c(0.1,0.6),
118
+ xlim = c(0.5, 3.5),
119
+ main = "Male (18-44)", xaxt = "n", xlab = "", ylab = "", cex.axis = 2.25, cex.main = 2.5,
120
+ cex = 2.25, cex.lab = 2.5)
121
+ segments(seq(1:3), mean_all_m - 1.96*se_all_m,
122
+ seq(1:3), mean_all_m + 1.96*se_all_m, pch = 19, lwd = 3)
123
+ Axis(side = 1, at = c(1,2,3), labels = c("1st tercile", "2nd tercile", "3rd tercile"), cex.axis = 2.25)
124
+ brackets(x1 = 1.1, y1 = 0.48, x2 = 1.9, y2 = 0.48, h = 0.01, type = 4)
125
+ brackets(x1 = 2.1, y1 = 0.48, x2 = 2.9, y2 = 0.48, h = 0.01, type = 4)
126
+ brackets(x1 = 1, y1 = 0.53, x2 = 3, y2 = 0.53, h = 0.03, type = 4)
127
+ text(x = 1.5, y = 0.51, paste0("pv = ", round(p_value[4],2)), cex = 1.95)
128
+ text(x = 2.5, y = 0.51, paste0("pv = ", round(p_value[5],2)), cex = 1.95)
129
+ # text(x = 2, y = 0.58, paste0("pv = ", round(p_value[6],2)), cex = 1.95)
130
+ text(x = 2, y = 0.58, paste0("pv = 0.00"), cex = 1.95)
131
+ mtext("Excess Males", side = 1, cex = 1.75, line = 3.75)
132
+ mtext("Proportion Perceiving\nMate Competition", side = 2, cex = 1.75, line = 3.75)
133
+
134
+
135
+ plot(seq(1:3), mean_all_y, pch = 19, ylim = c(0.1,0.75),
136
+ xlim = c(0.5, 3.5),
137
+ main = "Male (30 - 40)", xaxt = "n", xlab = "", ylab = "", cex.axis = 2.25, cex.main = 2.5,
138
+ cex = 2.25, cex.lab = 2.5)
139
+ segments(seq(1:3), mean_all_y - 1.96*se_all_y,
140
+ seq(1:3), mean_all_y + 1.96*se_all_y, pch = 19, lwd = 3)
141
+ Axis(side = 1, at = c(1,2,3), labels = c("1st tercile", "2nd tercile", "3rd tercile"), cex.axis = 2.25)
142
+ brackets(x1 = 1.1, y1 = 0.62, x2 = 1.9, y2 = 0.62, h = 0.03, type = 4)
143
+ brackets(x1 = 2.1, y1 = 0.62, x2 = 2.9, y2 = 0.62, h = 0.03, type = 4)
144
+ brackets(x1 = 1, y1 = 0.7, x2 = 3, y2 = 0.7, h = 0.03, type = 4)
145
+ text(x = 1.5, y = 0.67, paste0("pv = ", round(p_value[7],2)),cex = 1.95)
146
+ text(x = 2.5, y = 0.67, paste0("pv = ", round(p_value[8],2)), cex = 1.95)
147
+ text(x = 2, y = 0.75, paste0("pv = 0.00"), cex = 1.95)
148
+ # text(x = 2, y = 0.75, paste0("pv = ", round(p_value[9],3)))
149
+ mtext("Excess Males", side = 1, cex = 1.75, line = 3.75)
150
+ mtext("Proportion Perceiving\nMate Competition", side = 2, cex = 1.75, line = 3.75)
151
+
152
+ dev.off()
153
+
154
+ # ############################
155
+ # Main Models (Table 1)
156
+ # ############################
157
+ lm1 <- lm(hate_violence_means ~ MateComp.cont, data=dat_use)
158
+ summary(lm1)
159
+
160
+ lm2 <- lm(hate_violence_means ~ MateComp.cont + JobComp.cont + LifeSatis.cont, data=dat_use)
161
+ summary(lm2)
162
+
163
+ lm3 <- lm(hate_violence_means ~ MateComp.cont + JobComp.cont + LifeSatis.cont +
164
+ factor(age_group) + # age group
165
+ factor(gender) + # gender
166
+ factor(state) + # state
167
+ factor(citizenship) + # german citizen
168
+ factor(marital) + # marital status
169
+ factor(religion) + # religious affiliation
170
+ eduyrs + # education
171
+ factor(occupation) + # main activity
172
+ factor(income) + # income
173
+ factor(household_size) + # household size
174
+ factor(self_econ), # subjective social status
175
+ data=dat_use)
176
+ summary(lm3)
177
+
178
+ lm4 <- lm(hate_violence_means ~ MateComp.cont + JobComp.cont + LifeSatis.cont +
179
+ factor(age_group) + # age group
180
+ factor(gender) + # gender
181
+ factor(state) + # state
182
+ factor(citizenship) + # german citizen
183
+ factor(marital) + # marital status
184
+ factor(religion) + # religious affiliation
185
+ eduyrs + # education
186
+ factor(occupation) + # main activity
187
+ factor(income) + # income
188
+ factor(household_size) + # household size
189
+ factor(self_econ) + # subjective social status
190
+ factor(ref_integrating) + # Refugee Index (National-level; Q73) 8 in total
191
+ factor(ref_citizenship) + factor(ref_reduce) + factor(ref_moredone) + factor(ref_cultgiveup) +
192
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror),
193
+ data=dat_use)
194
+ summary(lm4)
195
+
196
+ lm5 <- lm(hate_violence_means ~ MateComp.cont + JobComp.cont + LifeSatis.cont +
197
+ factor(age_group) + # age group
198
+ factor(gender) + # gender
199
+ factor(state) + # state
200
+ factor(citizenship) + # german citizen
201
+ factor(marital) + # marital status
202
+ factor(religion) + # religious affiliation
203
+ eduyrs + # education
204
+ factor(occupation) + # main activity
205
+ factor(income) + # income
206
+ factor(household_size) + # household size
207
+ factor(self_econ) + # subjective social status
208
+ factor(ref_integrating) + # Refugee Index (National-level; Q73) 8 in total
209
+ factor(ref_citizenship) + factor(ref_reduce) + factor(ref_moredone) + factor(ref_cultgiveup) +
210
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror) +
211
+ factor(ref_loc_services) + # Refugee Index (Local, Q75)
212
+ factor(ref_loc_economy) + factor(ref_loc_crime) + factor(ref_loc_culture) + factor(ref_loc_islam) +
213
+ factor(ref_loc_schools) + factor(ref_loc_housing) + factor(ref_loc_wayoflife), ## end
214
+ data=dat_use)
215
+ summary(lm5)
216
+
217
+
218
+ # Add More Variables
219
+ # lrscale Q21 Left-Right Scale
220
+ # afd, Q23 Closeness to AfD
221
+ # muslim_ind, afd_ind, contact_ind
222
+ # distance_ref Q71. Distance to refugee reception centers
223
+ # settle_ref Q72. Settlement of refugees living in area
224
+
225
+ formula.5 <-
226
+ as.character("hate_violence_means ~ MateComp.cont + JobComp.cont +
227
+ LifeSatis.cont + factor(age_group) + factor(gender) +
228
+ factor(state) + factor(citizenship) + factor(marital) +
229
+ factor(religion) + eduyrs + factor(occupation) +
230
+ factor(income) + factor(household_size) + factor(self_econ) +
231
+ factor(ref_integrating) + factor(ref_citizenship) + factor(ref_reduce) +
232
+ factor(ref_moredone) + factor(ref_cultgiveup) +
233
+ factor(ref_economy) + factor(ref_crime) + factor(ref_terror) +
234
+ factor(ref_loc_services) + factor(ref_loc_economy) + factor(ref_loc_crime) +
235
+ factor(ref_loc_culture) + factor(ref_loc_islam) +
236
+ factor(ref_loc_schools) + factor(ref_loc_housing) + factor(ref_loc_wayoflife)")
237
+
238
+ formula.6 <- paste(formula.5, "factor(distance_ref) + factor(settle_ref)",
239
+ "lrscale + afd + muslim_ind + afd_ind + contact_ind",
240
+ sep="+", collapse="+")
241
+
242
+ lm6 <- lm(as.formula(formula.6), data=dat_use)
243
+ summary(lm6)
244
+
245
+ lm.list.table1 <- list(lm1, lm2, lm3, lm4, lm5, lm6)
246
+
247
+ # Table 1
248
+ star_out(stargazer(lm.list.table1,
249
+ covariate.labels = c("Mate Competition","Job Competition","Life Satisfaction"),
250
+ keep=c("MateComp.cont","JobComp.cont","LifeSatis.cont"),
251
+ star.char = c("\\dagger", "*", "**"),
252
+ notes = c("$^{\\dagger}$ p$<$0.1; $^{*}$ p$<$0.05; $^{**}$ p$<$0.01"), notes.append = FALSE),
253
+ name = "table1.tex")
254
+
255
+ ## #################
256
+ ## Figure 4
257
+ ## #################
258
+ # with Difference Outcomes
259
+ # hate_pol_message (v_320): "82. Support for Hate Crime_Attacks against refugee homes are somet"
260
+ # hate_prevent_settlement (v_319): "82. Support for Hate Crime_Racist violence is defensible if it lea"
261
+ # hate_polcondemn (v_316): "82. Support for Hate Crime_Politicians should condemn attacks agai"
262
+ # hate_justified (v_315): "82. Support for Hate Crime_Hostility against foreigners is sometimes justified"
263
+
264
+ formula.7.means <- paste("hate_violence_means ~ ", as.character(as.formula(formula.6))[3], sep = "")
265
+ formula.7.message <- paste("hate_pol_message ~", as.character(as.formula(formula.6))[3], sep = "")
266
+ formula.7.prevent <- paste("hate_prevent_settlement ~", as.character(as.formula(formula.6))[3], sep = "")
267
+ formula.7.condemn <- paste("hate_polcondemn ~ ", as.character(as.formula(formula.6))[3], sep = "")
268
+ formula.7.justified <- paste("hate_justified ~ ", as.character(as.formula(formula.6))[3], sep = "")
269
+
270
+ # output
271
+ lm7.means <- lm(as.formula(formula.7.means), data=dat_use)
272
+ lm7.justified <- lm(as.formula(formula.7.justified), data=dat_use)
273
+ lm7.message <- lm(as.formula(formula.7.message), data=dat_use)
274
+ lm7.prevent <- lm(as.formula(formula.7.prevent), data=dat_use)
275
+ lm7.condemn <- lm(as.formula(formula.7.condemn), data=dat_use)
276
+
277
+ # Figure 5
278
+ point <- c(coef(lm7.means)["MateComp.cont"],
279
+ coef(lm7.justified)["MateComp.cont"], coef(lm7.message)["MateComp.cont"],
280
+ coef(lm7.prevent)["MateComp.cont"], coef(lm7.condemn)["MateComp.cont"])
281
+
282
+ se <- c(summary(lm7.means)$coef["MateComp.cont", 2],
283
+ summary(lm7.justified)$coef["MateComp.cont", 2], summary(lm7.message)$coef["MateComp.cont", 2],
284
+ summary(lm7.prevent)$coef["MateComp.cont", 2], summary(lm7.condemn)$coef["MateComp.cont", 2])
285
+
286
+
287
+ pdf("figure_4.pdf", height = 4, width = 8)
288
+ par(mar = c(2,4,4,1))
289
+ plot(seq(1:5), point, pch = 19, ylim = c(-0.05, 0.25), xlim = c(0.5, 5.5),
290
+ xlab = "", xaxt = "n", ylab = "Estimated Effects",
291
+ main = "Estimated Effects of Mate Competition", cex.lab = 1.25, cex.axis = 1.25, cex.main = 1.5)
292
+ segments(seq(1:5), point - 1.96*se,
293
+ seq(1:5), point + 1.96*se, lwd = 2)
294
+ Axis(side=1, at = seq(1:5), labels = c("Only Means", "Justified", "Message",
295
+ "Prevent", "Condemn"), cex.axis = 1.25)
296
+ abline(h =0, lty = 2)
297
+ dev.off()
298
+
299
+ ## Table C.5 (in Appendix C.5)
300
+ # lm.list_d <- list(lm7.means, lm7.justified, lm7.message, lm7.prevent, lm7.condemn)
301
+ # stargazer(lm.list_d,
302
+ # covariate.labels = c("Mate Competition","Job Competition","Life Satisfaction"),
303
+ # keep=c("MateComp.cont","JobComp.cont","LifeSatis.cont"))
304
+
305
+
306
+ ## #############################
307
+ ## Figure 3: List Experiment
308
+ ## #############################
309
+ rm(list=ls())
310
+ # install.packages("readstata13") # readstata13_0.9.2
311
+ # install.packages("MASS") # MASS_7.3-51.6
312
+ # install.packages("sandwich") # sandwich_2.5-1
313
+ # install.packages("lmtest") # lmtest_0.9-37
314
+ # install.packages("list") # list_9.2
315
+
316
+ require(readstata13) # readstata13_0.9.2
317
+ require(MASS) # MASS_7.3-51.6
318
+ require(sandwich) # sandwich_2.5-1
319
+ require(lmtest) # lmtest_0.9-37
320
+ require(list) # list_9.2
321
+
322
+ dat <- read.dta13(file = "survey.dta")
323
+ data.u2 <- dat[dat$wave == 2, ]
324
+
325
+ # Means: When it comes to the refugee problem, violence is sometimes the only means that citizens have to get the attention of German politicians
326
+ data.list.u2 <- data.u2[data.u2$list == "1",]
327
+ data.direct.u2 <- data.u2[data.u2$list == "2",]
328
+ data.list.u2 <- data.list.u2[is.na(data.list.u2$treatment_list)==FALSE,]
329
+ data.list.u2$List.treat <- ifelse(data.list.u2$treatment_list == "Scenario 2", 1, 0)
330
+
331
+ ## Difference-in-Means
332
+ ## with Mean = 0.15401 sd = 0.03358
333
+ diff.in.means.results2 <- ictreg(outcome_list ~ 1, data = data.list.u2,
334
+ treat = "List.treat", J=3, method = "lm")
335
+ summary(diff.in.means.results2)
336
+
337
+ ## Compare to All People who answered Direct Question (n = 2170)
338
+ data.u2.all.direct <- data.u2[is.na(data.u2$hate_violence_means) == FALSE, ]
339
+ data.u2.all.direct$hate.direct.bin <- ifelse(data.u2.all.direct$hate_violence_means >=3, 1, 0)
340
+ point_dir2 <- mean(data.u2.all.direct$hate.direct.bin) ## 0.181
341
+ se_dir2 <- sd(data.u2.all.direct$hate.direct.bin)/sqrt(length(data.u2.all.direct$hate.direct.bin)) # 0.0083
342
+
343
+ # Compare Questions within Wave 2
344
+ # Direct Questions
345
+ data.u2$message.bin <- ifelse(data.u2$hate_pol_message >= 3, 1, 0)
346
+ data.u2$condemn.bin <- ifelse(data.u2$hate_polcondemn >= 3, 1, 0)
347
+ data.u2$justified.bin <- ifelse(data.u2$hate_justified >= 3, 1, 0)
348
+
349
+ message.mean2 <- mean(data.u2$message.bin)
350
+ condemn.mean2 <- mean(data.u2$condemn.bin)
351
+ justified.mean2 <- mean(data.u2$justified.bin)
352
+ message.se2 <- sd(data.u2$message.bin)/sqrt(length(data.u2$message.bin)) # 0.0070
353
+ condemn.se2 <- sd(data.u2$condemn.bin)/sqrt(length(data.u2$condemn.bin)) # 0.0079
354
+ justified.se2 <- sd(data.u2$justified.bin)/sqrt(length(data.u2$justified.bin)) # 0.0074
355
+
356
+ # plot
357
+ point <- c(summary(diff.in.means.results2)$par.treat, point_dir2, justified.mean2, message.mean2, condemn.mean2)
358
+ se_p <- c(summary(diff.in.means.results2)$se.treat, se_dir2, justified.se2, message.se2, condemn.se2)
359
+ base <- barplot(point, ylim = c(0, 0.20))
360
+ bar_name_u <- c("Only Means\n(List)","Only Means\n(Direct)", "Justified", "Message", "Condemn")
361
+ bar_name <- rep("",5)
362
+
363
+ pdf("figure_3.pdf", height = 4.5, width = 8)
364
+ par(mar = c(4, 5, 2, 1))
365
+ barplot(point, ylim = c(0, 0.3), names.arg = bar_name,
366
+ col = c(adjustcolor("red", 0.4), "gray", "gray", "gray", "gray"), cex.axis = 1.3,
367
+ ylab = "Proportion of respondents", cex.lab = 1.45)
368
+ arrows(base[,1], point - 1.96*se_p, base[,1], point + 1.96*se_p,
369
+ lwd = 3, angle = 90, length = 0.05, code = 3,
370
+ col = c("red", "black", "black", "black", "black"))
371
+ mtext(bar_name_u[1], outer = FALSE, side = 1, at = base[1], cex = 1.2, line = 2.4)
372
+ mtext(bar_name_u[2], outer = FALSE, side = 1, at = base[2], cex = 1.2, line = 2.4)
373
+ mtext(bar_name_u[3], outer = FALSE, side = 1, at = base[3], cex = 1.2, line = 2.4)
374
+ mtext(bar_name_u[4], outer = FALSE, side = 1, at = base[4], cex = 1.2, line = 2.4)
375
+ mtext(bar_name_u[5], outer = FALSE, side = 1, at = base[5], cex = 1.2, line = 2.4)
376
+ text(x = base[1], y = 0.275, "Estimate from \nList Experiment", col = "red", font = 2)
377
+ text(x = (base[3] + base[4])/2, y = 0.275, "Direct Questions", font = 2)
378
+ dev.off()
32/replication_package/YouGov.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68bc13dffdedff3ad30211644a050d0e85e24693ecaf6b2e8c95f6e37cfa9f5d
3
+ size 212090
32/replication_package/codebook_YouGov.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97b900343580543bff2743c8a158d93e1d6a9aedc0c8215911fe84c02c27c2d1
3
+ size 139433
32/replication_package/codebook_context.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ca51e10c3186ba504bf83bcea63385813cfb51ce1e354d47832e9cbb916d60a
3
+ size 140823
32/replication_package/codebook_context_placebo.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e04f05c86b1ad29b2e004537221a1ec4d610285d84a539227473f84dd938e7d9
3
+ size 164836
32/replication_package/codebook_survey.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99bb13e7d6936c4f57eaba442ae1d453db5368b1984dd8ec4e47023d732ae542
3
+ size 146756
32/replication_package/context.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe201f5a75c7d014e63a155ddbf44a8a144e0b93c366d1d58c7898bf411c6009
3
+ size 7408421
32/replication_package/context_placebo.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c300be8df5d3bf094c2cfe4fa5e7c70d55dd9902cd3369d789b434704a7abfc0
3
+ size 4064170
32/replication_package/master.R ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Main Analysis in the paper
2
+ source("ContextAnalysis_Main.R")
3
+ source("SurveyAnalysis_Main.R")
4
+
5
+ # Numbers we report in the paper
6
+ source("number_in_texts.R")
7
+
8
+ # Results in Appendix
9
+ source("ContextAnalysis_Appendix.R")
10
+ source("SurveyAnalysis_Appendix.R")
32/replication_package/merge_context.R ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Internal File for Merging datasets for producing "context.dta"
2
+ # R version 4.0.2 (2020-06-22)
3
+
4
+ rm(list=ls())
5
+ # install.packages("readstata13") # readstata13_0.9.2
6
+
7
+ require(readstata13) # readstata13_0.9.2
8
+
9
+ setwd("source_data")
10
+
11
+ # 0. Base data that contains AGS identifies and Year
12
+ base <- read.dta13("base.dta")
13
+
14
+ # Note:
15
+ # Every data source we use below is fully described in "source_context.pdf"
16
+
17
+ # 1. Hate Crime Data
18
+ hate <- read.dta13("hate.dta")
19
+ hate$Housing_all_muni <- hate$Arson_muni + hate$Other_muni
20
+ hate$Hate_all_muni <- hate$Housing_all_muni + hate$Physical_muni
21
+
22
+ context0 <- merge(base, hate[, c("ags_muni", "year",
23
+ "Hate_all_muni",
24
+ "Physical_muni")], by = c("ags_muni", "year"), all.x = TRUE)
25
+
26
+ # 2. Population Data
27
+ pop_dat <- read.dta13("pop_gemeinde_2008_2018.dta")
28
+ colnames(pop_dat)[colnames(pop_dat) == "ags"] <- "ags_muni"
29
+
30
+ pop_dat$pop_m_25_44 <- pop_dat$pop_m_25_29 + pop_dat$pop_m_30_34 + pop_dat$pop_m_35_39 + pop_dat$pop_m_40_44
31
+ pop_dat$pop_f_25_44 <- pop_dat$pop_f_25_29 + pop_dat$pop_f_30_34 + pop_dat$pop_f_35_39 + pop_dat$pop_f_40_44
32
+
33
+ pop_dat$pop_m_15_44 <- pop_dat$pop_m_15_17 + pop_dat$pop_m_18_19 + pop_dat$pop_m_20_24 + pop_dat$pop_m_25_44
34
+ pop_dat$pop_f_15_44 <- pop_dat$pop_f_15_17 + pop_dat$pop_f_18_19 + pop_dat$pop_f_20_24 + pop_dat$pop_f_25_44
35
+
36
+ pop_dat$population_muni <- pop_dat$pop_mf_total
37
+
38
+ pop_dat$pop_25_44_muni_gendergap <- pop_dat$pop_m_25_44/pop_dat$pop_f_25_44
39
+ pop_dat$pop_15_44_muni_gendergap <- pop_dat$pop_m_15_44/pop_dat$pop_f_15_44
40
+ pop_dat$pop_25_44_muni_gendergap[is.infinite(pop_dat$pop_25_44_muni_gendergap)] <- NA
41
+ pop_dat$pop_15_44_muni_gendergap[is.infinite(pop_dat$pop_15_44_muni_gendergap)] <- NA
42
+
43
+ pop_dat_2015 <- subset(pop_dat, year == 2015)
44
+ pop_dat_2015$pop_25_44_muni_gendergap_2015 <- pop_dat_2015$pop_m_25_44/pop_dat_2015$pop_f_25_44
45
+ pop_dat_2015$pop_15_44_muni_gendergap_2015 <- pop_dat_2015$pop_m_15_44/pop_dat_2015$pop_f_15_44
46
+ pop_dat_2015$pop_25_44_muni_gendergap_2015[is.infinite(pop_dat_2015$pop_25_44_muni_gendergap_2015)] <- NA
47
+ pop_dat_2015$pop_15_44_muni_gendergap_2015[is.infinite(pop_dat_2015$pop_15_44_muni_gendergap_2015)] <- NA
48
+
49
+ pop_dat_2015$population_muni_2015 <- pop_dat_2015$pop_mf_total
50
+
51
+
52
+ # 3. area
53
+ area <- read.dta13("area_mun.dta")
54
+ area_use <- area[area$ags %in% context0$ags_muni, ]
55
+ colnames(area_use)[colnames(area_use) == "ags"] <- "ags_muni"
56
+
57
+ pop_dat_2015 <- merge(pop_dat_2015, area_use[,c("ags_muni", "area_sqk")], all.x = TRUE)
58
+ pop_dat_2015$popdens_muni_2015 <- pop_dat_2015$population_muni_2015/pop_dat_2015$area_sqk
59
+
60
+ pop_dat <- merge(pop_dat, area_use[,c("ags_muni", "area_sqk")], all.x = TRUE)
61
+ pop_dat$popdens_muni <- pop_dat$population_muni/pop_dat$area_sqk
62
+
63
+ context0 <- merge(context0, pop_dat_2015[, c("ags_muni",
64
+ "pop_25_44_muni_gendergap_2015",
65
+ "pop_15_44_muni_gendergap_2015",
66
+ "population_muni_2015",
67
+ "popdens_muni_2015")], by = c("ags_muni"), all.x = TRUE)
68
+
69
+ # 4. Unemployment
70
+ pop_dat <- read.dta13("pop_gemeinde_2008_2018.dta")
71
+ colnames(pop_dat)[colnames(pop_dat) == "ags"] <- "ags_muni"
72
+ pop_dat$pop_m_25_44 <- pop_dat$pop_m_25_29 + pop_dat$pop_m_30_34 + pop_dat$pop_m_35_39 + pop_dat$pop_m_40_44
73
+ pop_dat$pop_f_25_44 <- pop_dat$pop_f_25_29 + pop_dat$pop_f_30_34 + pop_dat$pop_f_35_39 + pop_dat$pop_f_40_44
74
+ pop_dat$pop_m_15_44 <- pop_dat$pop_m_15_17 + pop_dat$pop_m_18_19 + pop_dat$pop_m_20_24 + pop_dat$pop_m_25_44
75
+ pop_dat$pop_f_15_44 <- pop_dat$pop_f_15_17 + pop_dat$pop_f_18_19 + pop_dat$pop_f_20_24 + pop_dat$pop_f_25_44
76
+ unemp_dat <- read.dta13("unempl_gemeinde_2008_2017.dta")
77
+ colnames(unemp_dat)[colnames(unemp_dat) == "ags"] <- "ags_muni"
78
+ colnames(unemp_dat)[colnames(unemp_dat) == "ags_dist"] <- "ags_county"
79
+
80
+ ## unemployed as share of working age population (age 15-64)
81
+ pop_dat$pop_mf_15_64 <- pop_dat$pop_mf_15_17 + pop_dat$pop_mf_18_19 + pop_dat$pop_mf_20_24 +
82
+ pop_dat$pop_mf_25_29 + pop_dat$pop_mf_30_34 + pop_dat$pop_mf_35_39 + pop_dat$pop_mf_40_44 +
83
+ pop_dat$pop_mf_45_49 + pop_dat$pop_mf_50_54 + pop_dat$pop_mf_55_59 + pop_dat$pop_mf_60_64
84
+
85
+ pop_dat$pop_m_15_64 <- pop_dat$pop_m_15_44 + pop_dat$pop_m_45_49 + pop_dat$pop_m_50_54 +
86
+ pop_dat$pop_m_55_59 + pop_dat$pop_m_60_64
87
+
88
+ pop_dat$pop_f_15_64 <- pop_dat$pop_f_15_44 + pop_dat$pop_f_45_49 + pop_dat$pop_f_50_54 +
89
+ pop_dat$pop_f_55_59 + pop_dat$pop_f_60_64
90
+
91
+ unemp_dat_use <- unemp_dat[, c("ags_muni", "ags_county",
92
+ "year",
93
+ "unempl_all_total",
94
+ "unempl_all_male_total",
95
+ "unempl_all_fem_total")]
96
+ pop_dat_m <- pop_dat[pop_dat$year >= 2011, c("ags_muni", "year", "pop_mf_15_64", "pop_m_15_64", "pop_f_15_64")]
97
+ unemp_merge <- merge(pop_dat_m, unemp_dat_use, by = c("ags_muni", "year"), all.x = TRUE, all.y = FALSE)
98
+ unemp_merge$unemp_all_muni <- (unemp_merge$unempl_all_total/unemp_merge$pop_mf_15_64)*100
99
+
100
+ unemp_2015 <- unemp_merge[unemp_merge$year == 2015, ]
101
+ unemp_2015$unemp_all_muni_2015 <- unemp_2015$unemp_all_muni
102
+ unemp_2015$log_unemp_all_muni_2015 <- log(unemp_2015$unemp_all_muni_2015 + 1)
103
+
104
+ context0 <- merge(context0, unemp_2015[, c("ags_muni",
105
+ "log_unemp_all_muni_2015")], by = c("ags_muni"),
106
+ all.x = TRUE, all.y = FALSE)
107
+
108
+ # 5. Unemployment Gender Gap
109
+ d2 <- read.dta13("merged_context_2.dta") # we created this data set in "produce_context_data.do"
110
+ d2_15 <- d2[d2$year == 2015, ]
111
+ d2_15$unemp_gendergap_2015 <- round(d2_15$unemp_gendergap, 6)
112
+
113
+ context0 <- merge(context0, d2_15[, c("ags_county", "unemp_gendergap_2015")],
114
+ all.x = TRUE, all.y = FALSE, by = "ags_county")
115
+
116
+ # 6. Population Change
117
+ pop_dat <- read.dta13("pop_gemeinde_2008_2018.dta")
118
+ colnames(pop_dat)[colnames(pop_dat) == "ags"] <- "ags_muni"
119
+ pop_dat$population_muni <- pop_dat$pop_mf_total
120
+ pop_dat_2015 <- subset(pop_dat, year == 2015)
121
+ pop_dat_2011 <- subset(pop_dat, year == 2011)
122
+ pop_dat_2015$d_pop1511_muni <-
123
+ (pop_dat_2015$population_muni - pop_dat_2011$population_muni)/pop_dat_2011$population_muni
124
+
125
+ context0 <- merge(context0, pop_dat_2015[, c("ags_muni",
126
+ "d_pop1511_muni")], by = c("ags_muni"), all.x = TRUE)
127
+
128
+ # 7. Voting
129
+ voting <- read.dta13("voting.dta")
130
+
131
+ context0 <- merge(context0, voting[, c("ags_muni",
132
+ "vote_afd_2013_muni")], by = c("ags_muni"), all.x = TRUE)
133
+
134
+ # 8. Refugee Data
135
+ ref_dat <- read.dta13("refugees_2008_2017.dta")
136
+ ref_2014 <- subset(ref_dat, year == 2014)
137
+ ref_2015 <- subset(ref_dat, year == 2015)
138
+ table(ref_2014$ags_county == ref_2015$ags_county)
139
+
140
+ ref_2014$ref_inflow_1514 <- ref_2015$pop_ref - ref_2014$pop_ref
141
+ ref_2014$log_ref_inflow_1514 <- log(1500 + ref_2014$ref_inflow_1514)
142
+
143
+ ref_2014$pop_ref_2014 <- ref_2014$pop_ref
144
+ ref_2014$pop_ref_2015 <- ref_2015$pop_ref
145
+
146
+ # Proportion of male refugees
147
+ ref_prop <- read.dta13("merged_context_2.dta") # we created this data set in "produce_context_data.do"
148
+
149
+ context0 <- merge(context0, ref_2014[, c("ags_county",
150
+ "log_ref_inflow_1514",
151
+ "pop_ref_2014")], by = c("ags_county"), all.x = TRUE)
152
+ context0 <- merge(context0, ref_prop[, c("year", "ags_county",
153
+ "pc_ref_male")], by = c("year", "ags_county"), all.x = TRUE)
154
+
155
+ # 9. Violence
156
+ crime <- read.dta13("crime.dta")
157
+ crime <- crime[crime$year == 2015, ]
158
+
159
+ pop_county <- read.dta13("pop_kreise_2015_2017.dta")
160
+ pop_county1 <- subset(pop_county, year == 2015)
161
+
162
+ crime2 <- merge(crime[, c("ags_county", "violence_num_cases")],
163
+ pop_county1[, c("ags_county", "population")],
164
+ by = "ags_county", all.x = TRUE, all.y = FALSE)
165
+ crime2$violence_percap_2015 <- crime2$violence_num_cases/crime2$population
166
+
167
+ context0 <- merge(context0, crime2[, c("ags_county",
168
+ "violence_percap_2015")], by = c("ags_county"), all.x = TRUE)
169
+
170
+ # 10. Education
171
+ edu <- read.dta13("merged_context_2.dta") # we created this data set in "produce_context_data.do"
172
+ edu <- edu[edu$year == 2011, ]
173
+ edu <- edu[, c("ags_county", "pc_hidegree_all2011")]
174
+
175
+ context0 <- merge(context0, edu[, c("ags_county",
176
+ "pc_hidegree_all2011")], by = c("ags_county"), all.x = TRUE)
177
+
178
+
179
+ # 10. Industry
180
+ manu0 <- read.dta13("merged_context_2.dta") # we created this data set in "produce_context_data.do"
181
+ manu0 <- manu0[, c("year", "ags_county", "pc_manufacturing")]
182
+ manu <- manu0[manu0$year >= 2011 & manu0$year <= 2015, ]
183
+ rownames(manu) <- NULL
184
+ manu_orig <- manu
185
+
186
+ manu <- manu_orig[manu_orig$year == 2015, ]
187
+ manu <- manu[, c("ags_county", "pc_manufacturing")]
188
+ manu <- manu[is.element(manu$ags_county, unique(context0$ags_county)),]
189
+ manu$pc_manufacturing_2015 <- manu$pc_manufacturing
190
+
191
+ manu2011 <- manu_orig[manu_orig$year == 2011, ]
192
+ manu2011 <- manu2011[, c("ags_county", "pc_manufacturing")]
193
+ manu2011 <- manu2011[is.element(manu2011$ags_county, unique(context0$ags_county)),]
194
+ manu2011$pc_manufacturing_2011 <- manu2011$pc_manufacturing
195
+
196
+ # d_manuf1115
197
+ manu$d_manuf1115 <- manu$pc_manufacturing_2015 - manu2011$pc_manufacturing_2011
198
+
199
+ context0 <- merge(context0, manu[, c("ags_county",
200
+ "pc_manufacturing_2015",
201
+ "d_manuf1115")], by = c("ags_county"), all.x = TRUE)
202
+
203
+ # 11. East
204
+ context0$east <- 0
205
+ context0$east[context0$ags_state %in% c("11","12","13","14","15","16")] <- 1
206
+
207
+ # 12. Create additional variables
208
+ context0$Hate_all_muni_bin <- as.numeric(context0$Hate_all_muni > 0)
209
+ context0$Physical_muni_bin <- as.numeric(context0$Physical_muni > 0)
210
+
211
+ context0$log_population_muni_2015 <- log(context0$population_muni_2015)
212
+ context0$log_popdens_muni_2015 <- log(context0$popdens_muni_2015)
213
+ context0$log_pop_ref_2014 <- log(context0$pop_ref_2014)
214
+ context0$log_violence_percap_2015 <- log(context0$violence_percap_2015)
215
+
216
+ context0 <- context0[order(context0$year, context0$ags_muni), ]
217
+ save.dta13(context0, file = "context.dta")
32/replication_package/merge_context_placebo.R ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ rm(list = ls())
2
+ # install.packages("readstata13") # readstata13_0.9.2
3
+ # install.packages("plm") # plm_2.2-3
4
+
5
+ library(readstata13) # readstata13_0.9.2
6
+ library(plm) # plm_2.2-3
7
+
8
+ setwd("source_data")
9
+
10
+ # 0. Base data that contains AGS identifies and Year
11
+ base_pl <- read.dta13("base_pl.dta")
12
+
13
+ # Note:
14
+ # Every data source we use below is fully described in "source_context.pdf"
15
+
16
+ # 1. Hate Crime Data
17
+ hate <- read.dta13("hate.dta")
18
+ hate$Housing_all_muni <- hate$Arson_muni + hate$Other_muni
19
+ hate$Hate_all_muni <- hate$Housing_all_muni + hate$Physical_muni
20
+
21
+
22
+ context0 <- merge(base_pl, hate[, c("ags_muni", "year",
23
+ "Hate_all_muni")], by = c("ags_muni", "year"), all.x = TRUE)
24
+
25
+ # 2. Population Data
26
+ pop_dat <- read.dta13("pop_gemeinde_2008_2018.dta")
27
+ pop_dat <- pop_dat[pop_dat$year >= 2011, ]
28
+
29
+ pop_dat$pop_m_25_44 <- pop_dat$pop_m_25_29 + pop_dat$pop_m_30_34 + pop_dat$pop_m_35_39 + pop_dat$pop_m_40_44
30
+ pop_dat$pop_f_25_44 <- pop_dat$pop_f_25_29 + pop_dat$pop_f_30_34 + pop_dat$pop_f_35_39 + pop_dat$pop_f_40_44
31
+
32
+ pop_dat$pop_m_15_44 <- pop_dat$pop_m_15_17 + pop_dat$pop_m_18_19 + pop_dat$pop_m_20_24 + pop_dat$pop_m_25_44
33
+ pop_dat$pop_f_15_44 <- pop_dat$pop_f_15_17 + pop_dat$pop_f_18_19 + pop_dat$pop_f_20_24 + pop_dat$pop_f_25_44
34
+
35
+ pop_dat$population_muni_anu <- pop_dat$pop_mf_total
36
+
37
+ pop_dat$pop_25_44_muni_gendergap_anu <- pop_dat$pop_m_25_44/pop_dat$pop_f_25_44
38
+ pop_dat$pop_15_44_muni_gendergap_anu <- pop_dat$pop_m_15_44/pop_dat$pop_f_15_44
39
+ pop_dat$pop_25_44_muni_gendergap_anu[is.infinite(pop_dat$pop_25_44_muni_gendergap_anu)] <- NA
40
+ pop_dat$pop_15_44_muni_gendergap_anu[is.infinite(pop_dat$pop_15_44_muni_gendergap_anu)] <- NA
41
+
42
+ pop_dat_pl <- pop_dat[, c("year", "ags_muni","ags_county", "ags_state",
43
+ "population_muni_anu", "pop_15_44_muni_gendergap_anu")]
44
+
45
+ # creating pop_15_44_muni_gendergap_future
46
+ pop_dat_pl_p <- pdata.frame(pop_dat_pl, index = c("ags_muni", "year"))
47
+ pop_dat_pl_p$pop_15_44_muni_gendergap_future <- as.numeric(lead(pop_dat_pl_p$pop_15_44_muni_gendergap_anu, k = 1))
48
+ class(pop_dat_pl_p) <- "data.frame"
49
+ pop_dat_pl <- pop_dat_pl_p
50
+ rownames(pop_dat_pl) <- NULL
51
+
52
+ # 3. area
53
+ area <- read.dta13("area_mun.dta")
54
+ area_use <- area[area$ags %in% base_pl$ags_muni, ]
55
+ colnames(area_use)[colnames(area_use) == "ags"] <- "ags_muni"
56
+
57
+ pop_dat_pl <- merge(pop_dat_pl, area_use[,c("ags_muni", "area_sqk")], all.x = TRUE, all.y = FALSE)
58
+ pop_dat_pl$popdens_muni_anu <- pop_dat_pl$population_muni_anu/pop_dat_pl$area_sqk
59
+
60
+ pop_dat_2015 <- subset(pop_dat_pl, year == 2015)
61
+ pop_dat_2011 <- subset(pop_dat_pl, year == 2011)
62
+ pop_dat_2011 <- pop_dat_2011[match(pop_dat_2015$ags_muni, pop_dat_2011$ags_muni),]
63
+ pop_dat_2015$d_pop_muni_anu <-
64
+ (pop_dat_2015$population_muni - pop_dat_2011$population_muni)/pop_dat_2011$population_muni
65
+
66
+ pop_dat_2016 <- subset(pop_dat_pl, year == 2016)
67
+ pop_dat_2012 <- subset(pop_dat_pl, year == 2012)
68
+ pop_dat_2012 <- pop_dat_2012[match(pop_dat_2016$ags_muni, pop_dat_2012$ags_muni),]
69
+ pop_dat_2016$d_pop_muni_anu <-
70
+ (pop_dat_2016$population_muni - pop_dat_2012$population_muni)/pop_dat_2012$population_muni
71
+
72
+ pop_dat_2017 <- subset(pop_dat_pl, year == 2017)
73
+ pop_dat_2013 <- subset(pop_dat_pl, year == 2013)
74
+ pop_dat_2013 <- pop_dat_2013[match(pop_dat_2017$ags_muni, pop_dat_2013$ags_muni),]
75
+ pop_dat_2017$d_pop_muni_anu <-
76
+ (pop_dat_2017$population_muni - pop_dat_2013$population_muni)/pop_dat_2013$population_muni
77
+
78
+ pop_dat_d <- rbind(pop_dat_2015, pop_dat_2016, pop_dat_2017)
79
+
80
+ context0 <- merge(context0, pop_dat_d[, c("year", "ags_muni",
81
+ "pop_15_44_muni_gendergap_anu",
82
+ "pop_15_44_muni_gendergap_future",
83
+ "population_muni_anu",
84
+ "popdens_muni_anu",
85
+ "d_pop_muni_anu")], by = c("year", "ags_muni"),
86
+ all.x = TRUE, all.y = FALSE)
87
+
88
+ # 4. Unemployment
89
+ pop_dat <- read.dta13("pop_gemeinde_2008_2018.dta")
90
+ colnames(pop_dat)[colnames(pop_dat) == "ags"] <- "ags_muni"
91
+ pop_dat$pop_m_25_44 <- pop_dat$pop_m_25_29 + pop_dat$pop_m_30_34 + pop_dat$pop_m_35_39 + pop_dat$pop_m_40_44
92
+ pop_dat$pop_f_25_44 <- pop_dat$pop_f_25_29 + pop_dat$pop_f_30_34 + pop_dat$pop_f_35_39 + pop_dat$pop_f_40_44
93
+ pop_dat$pop_m_15_44 <- pop_dat$pop_m_15_17 + pop_dat$pop_m_18_19 + pop_dat$pop_m_20_24 + pop_dat$pop_m_25_44
94
+ pop_dat$pop_f_15_44 <- pop_dat$pop_f_15_17 + pop_dat$pop_f_18_19 + pop_dat$pop_f_20_24 + pop_dat$pop_f_25_44
95
+ unemp_dat <- read.dta13("unempl_gemeinde_2008_2017.dta")
96
+ colnames(unemp_dat)[colnames(unemp_dat) == "ags"] <- "ags_muni"
97
+ colnames(unemp_dat)[colnames(unemp_dat) == "ags_dist"] <- "ags_county"
98
+
99
+ ## unemployed as share of working age population (age 15-64)
100
+ pop_dat$pop_mf_15_64 <- pop_dat$pop_mf_15_17 + pop_dat$pop_mf_18_19 + pop_dat$pop_mf_20_24 +
101
+ pop_dat$pop_mf_25_29 + pop_dat$pop_mf_30_34 + pop_dat$pop_mf_35_39 + pop_dat$pop_mf_40_44 +
102
+ pop_dat$pop_mf_45_49 + pop_dat$pop_mf_50_54 + pop_dat$pop_mf_55_59 + pop_dat$pop_mf_60_64
103
+
104
+ pop_dat$pop_m_15_64 <- pop_dat$pop_m_15_44 + pop_dat$pop_m_45_49 + pop_dat$pop_m_50_54 +
105
+ pop_dat$pop_m_55_59 + pop_dat$pop_m_60_64
106
+
107
+ pop_dat$pop_f_15_64 <- pop_dat$pop_f_15_44 + pop_dat$pop_f_45_49 + pop_dat$pop_f_50_54 +
108
+ pop_dat$pop_f_55_59 + pop_dat$pop_f_60_64
109
+
110
+ unemp_dat_use <- unemp_dat[, c("ags_muni", "ags_county",
111
+ "year",
112
+ "unempl_all_total",
113
+ "unempl_all_male_total", "unempl_all_fem_total")]
114
+ pop_dat_m <- pop_dat[pop_dat$year >= 2011, c("ags_muni", "year", "pop_mf_15_64", "pop_m_15_64", "pop_f_15_64")]
115
+ unemp_merge <- merge(pop_dat_m, unemp_dat_use, by = c("ags_muni", "year"), all.x = TRUE, all.y = FALSE)
116
+
117
+ unemp_merge$unemp_all_muni <- (unemp_merge$unempl_all_total/unemp_merge$pop_mf_15_64)*100
118
+
119
+ dat_2015 <- unemp_merge[unemp_merge$year == 2015, ]
120
+ dat_2016 <- unemp_merge[unemp_merge$year == 2016, ]
121
+ dat_2017 <- unemp_merge[unemp_merge$year == 2017, ]
122
+
123
+ dat_2015$log_unemp_all_muni_anu <- log(dat_2015$unemp_all_muni + 1) # constants are chosen to make sure all values are positive
124
+ dat_2016$log_unemp_all_muni_anu <- log(dat_2016$unemp_all_muni + 0.3)
125
+ dat_2017$log_unemp_all_muni_anu <- log(dat_2017$unemp_all_muni + 0.3)
126
+ unemp_u <- rbind(dat_2015, dat_2016, dat_2017)
127
+
128
+ context0 <- merge(context0, unemp_u[, c("ags_muni", "year",
129
+ "log_unemp_all_muni_anu")],
130
+ by = c("ags_muni", "year"), all.x = TRUE, all.y = FALSE)
131
+
132
+ # 5 Unemployment Rate Gap
133
+ d20 <- read.dta13("merged_context_2.dta")
134
+ d2 <- unique(d20[, c("year", "ags_county", "unemp_gendergap")])
135
+ d2$unemp_gendergap_anu <- d2$unemp_gendergap
136
+
137
+ context0 <- merge(context0, d2[, c("year", "ags_county", "unemp_gendergap_anu")],
138
+ all.x = TRUE, all.y = FALSE, by = c("year", "ags_county"))
139
+
140
+ # 6. Voting
141
+ voting <- read.dta13("voting.dta")
142
+
143
+ context0 <- merge(context0, voting[, c("ags_muni",
144
+ "vote_afd_2013_muni")], by = c("ags_muni"),
145
+ all.x = TRUE, all.y = FALSE)
146
+
147
+ # 7. Refugee Data
148
+ ref_dat <- read.dta13("refugees_2008_2017.dta")
149
+ ref_dat <- ref_dat[ref_dat$year >= 2011, ]
150
+
151
+ # Creating pop_ref_anu
152
+ ref_dat_p <- pdata.frame(ref_dat, index = c("ags_county", "year"))
153
+ ref_dat_p$pop_ref_anu <- as.numeric(lag(ref_dat_p$pop_ref, k = 1))
154
+ class(ref_dat_p) <- "data.frame"
155
+ ref_dat <- ref_dat_p
156
+
157
+ ref_dat <- ref_dat[ref_dat$ags_county %in% unique(ref_dat$ags_county[ref_dat$year == 2014]),]
158
+ ref_2014 <- ref_dat[ref_dat$year == 2014, ]
159
+ ref_2015 <- ref_dat[ref_dat$year == 2015, ]
160
+ ref_2016 <- ref_dat[ref_dat$year == 2016, ]
161
+ ref_2017 <- ref_dat[ref_dat$year == 2017, ]
162
+
163
+ ref_2015$ref_inflow_1514 <- ref_2015$pop_ref - ref_2014$pop_ref
164
+ ref_2016$ref_inflow_1615 <- ref_2016$pop_ref - ref_2015$pop_ref
165
+ ref_2017$ref_inflow_1716 <- ref_2017$pop_ref - ref_2016$pop_ref
166
+
167
+ ref_2015$log_ref_inflow_anu <- log(1500 + ref_2015$ref_inflow_1514) # constants are chosen such that all values are positive
168
+ suppressWarnings(ref_2016$log_ref_inflow_anu <- log(ref_2016$ref_inflow_1615 + 649))
169
+ suppressWarnings(ref_2017$log_ref_inflow_anu <- log(ref_2017$ref_inflow_1716 + 1261))
170
+
171
+ ref_2015 <- ref_2015[, c("year", "ags_county", "pop_ref_anu", "log_ref_inflow_anu")]
172
+ ref_2016 <- ref_2016[, c("year", "ags_county", "pop_ref_anu", "log_ref_inflow_anu")]
173
+ ref_2017 <- ref_2017[, c("year", "ags_county", "pop_ref_anu", "log_ref_inflow_anu")]
174
+ ref_data_c <- rbind(ref_2015, ref_2016, ref_2017)
175
+
176
+ context0 <- merge(context0, ref_data_c[, c("year", "ags_county",
177
+ "pop_ref_anu",
178
+ "log_ref_inflow_anu")],
179
+ by = c("year", "ags_county"), all.x = TRUE, all.y = FALSE)
180
+
181
+ # 8. Violence
182
+ crime <- read.dta13("crime.dta")
183
+ pop <- read.dta13("pop_kreise_2015_2017.dta")
184
+
185
+ crime2 <- merge(crime[, c("year", "ags_county", "violence_num_cases")],
186
+ pop[, c("year", "ags_county", "population")],
187
+ by = c("year", "ags_county"), all.x = TRUE, all.y = FALSE)
188
+ crime2$violence_percap_anu <- crime2$violence_num_cases/crime2$population
189
+
190
+ context0 <- merge(context0, crime2[, c("year", "ags_county",
191
+ "violence_percap_anu")], by = c("year", "ags_county"),
192
+ all.x = TRUE, all.y = FALSE)
193
+
194
+ # 9. Education
195
+ edu <- read.dta13("merged_context_2.dta")
196
+ edu <- edu[edu$year == 2011, ]
197
+ edu <- edu[, c("ags_county", "pc_hidegree_all2011")]
198
+
199
+
200
+ context0 <- merge(context0, edu[, c("ags_county", "pc_hidegree_all2011")], by = c("ags_county"), all.x = TRUE)
201
+
202
+ # 10. Industry
203
+ manu0 <- read.dta13("merged_context_2.dta")
204
+ manu0 <- manu0[, c("year", "ags_county", "pc_manufacturing")]
205
+ manu <- manu0[manu0$year >= 2011 & manu0$year <= 2015, ]
206
+ rownames(manu) <- NULL
207
+ manu_orig <- manu
208
+
209
+ manu <- manu_orig[manu_orig$year == 2015, ]
210
+ manu <- manu[, c("ags_county", "pc_manufacturing")]
211
+ manu <- manu[is.element(manu$ags_county, unique(base_pl$ags_county)),]
212
+ manu$pc_manufacturing_2015 <- manu$pc_manufacturing
213
+
214
+ manu2011 <- manu_orig[manu_orig$year == 2011, ]
215
+ manu2011 <- manu2011[, c("ags_county", "pc_manufacturing")]
216
+ manu2011 <- manu2011[is.element(manu2011$ags_county, unique(base_pl$ags_county)),]
217
+ manu2011$pc_manufacturing_2011 <- manu2011$pc_manufacturing
218
+
219
+ # d_manuf1115
220
+ manu$d_manuf1115 <- manu$pc_manufacturing_2015 - manu2011$pc_manufacturing_2011
221
+
222
+ context0 <- merge(context0, manu[, c("ags_county",
223
+ "pc_manufacturing_2015",
224
+ "d_manuf1115")], by = c("ags_county"), all.x = TRUE)
225
+
226
+
227
+ # 11. Create additional variables
228
+ context0$Hate_all_muni_bin <- as.numeric(context0$Hate_all_muni > 0)
229
+
230
+ context0 <- context0[order(context0$year, context0$ags_muni), ]
231
+ save.dta13(context0, file = "context_placebo.dta")
32/replication_package/number_in_texts.R ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Replication File for numbers we mention in the main text of the paper.
2
+ # Please see "ContextAnalysis_Main.R", "SurveyAnalysis_Main.R", "ContextAnalysis_Appendix.R", and "SurveyAnalysis_Appendix.R"
3
+ # to reproduce Tables and Figures in the paper and in the appendix.
4
+
5
+ # R version 4.0.2 (2020-06-22)
6
+
7
+ rm(list=ls())
8
+ # install.packages("readstata13") # readstata13_0.9.2
9
+ # install.packages("MASS") # MASS_7.3-51.6
10
+ # install.packages("sandwich") # sandwich_2.5-1
11
+ # install.packages("lmtest") # lmtest_0.9-37
12
+
13
+ require(readstata13) # readstata13_0.9.2
14
+ require(MASS) # MASS_7.3-51.6
15
+ require(sandwich) # sandwich_2.5-1
16
+ require(lmtest) # lmtest_0.9-37
17
+ source("Help.R")
18
+
19
+ # ###############
20
+ # Section: Existing Explanations and Mate Competition
21
+ # ###############
22
+ you_data <- read.dta13(file = "YouGov.dta")
23
+
24
+ # The number of people who think marriages between a German woman and a non-German man is common and very common
25
+ prop.table(table(you_data$int_marriage))[3:4]
26
+
27
+ # ###############
28
+ # Section: Refugees and Mate Competition: A Topic of Debate
29
+ # ###############
30
+ # The number of hate crimes in 2015 and 2016
31
+ dat <- read.dta13("context.dta")
32
+ tapply(dat$Hate_all_muni, dat$year, sum)[1:2]
33
+
34
+
35
+ # ###############
36
+ # Section: Empirical Analyses
37
+ # ###############
38
+ # ###############
39
+ # Sub Section: Mate Competition and the Incidence of Anti-Refugee Hate Crime
40
+ # ###############
41
+ # The proportion of municipalities that witnessed at least one hate crime in each year
42
+ round(tapply(dat$Hate_all_muni_bin, dat$year, mean)*100, 1)
43
+
44
+ # The proportion of municipalities that witnessed at least one hate crime in three years
45
+ dat_2015 <- dat[dat$year == 2015, ]
46
+ dat_2016 <- dat[dat$year == 2016, ]
47
+ dat_2017 <- dat[dat$year == 2017, ]
48
+ dat_2015$Hate_all_muni_1517 <- dat_2015$Hate_all_muni + dat_2016$Hate_all_muni + dat_2017$Hate_all_muni
49
+ dat_2015$Hate_all_muni_1517_bin <- ifelse(dat_2015$Hate_all_muni_1517 > 0, 1, 0)
50
+ round(mean(dat_2015$Hate_all_muni_1517_bin)*100)
51
+
52
+ # Point Estimates that we mention when discussing Figure 1
53
+ # Remove Extreme Value of Excess Males
54
+ range_x <- quantile(dat_2015$pop_15_44_muni_gendergap_2015, c(0.025, 0.975), na.rm = TRUE)
55
+ dat_2015_s <- dat_2015[dat_2015$pop_15_44_muni_gendergap_2015 >= range_x[1] &
56
+ dat_2015$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
57
+ dat_s <- dat[dat$pop_15_44_muni_gendergap_2015 >= range_x[1] &
58
+ dat$pop_15_44_muni_gendergap_2015 <= range_x[2], ]
59
+
60
+ # The size of population for exxluded municipalities
61
+ dat_exc <- dat[dat$pop_15_44_muni_gendergap_2015 < range_x[1] |
62
+ dat$pop_15_44_muni_gendergap_2015 > range_x[2], ]
63
+
64
+ ceiling(median(dat_exc$population_muni_2015, na.rm = TRUE)) # 247
65
+
66
+ # sum
67
+ bin_1_sum <- bin.summary(Hate_all_muni_1517_bin ~
68
+ pop_15_44_muni_gendergap_2015 +
69
+ log_population_muni_2015 + log_popdens_muni_2015 +
70
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
71
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
72
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
73
+ unemp_gendergap_2015 + as.factor(ags_state),
74
+ id = "ags_county", data = dat_2015_s)
75
+
76
+ # annual
77
+ bin_1_p <- bin.summary(Hate_all_muni_bin ~
78
+ pop_15_44_muni_gendergap_2015 +
79
+ log_population_muni_2015 + log_popdens_muni_2015 +
80
+ log_unemp_all_muni_2015 + d_pop1511_muni + vote_afd_2013_muni +
81
+ log_ref_inflow_1514 + log_pop_ref_2014 + log_violence_percap_2015 + ## county level
82
+ pc_hidegree_all2011 + d_manuf1115 + pc_manufacturing_2015 + ## county level
83
+ unemp_gendergap_2015 + as.factor(ags_state) + as.factor(year),
84
+ id = "ags_county", data = dat_s)
85
+
86
+ # Excess Males
87
+ # Effect Estimation
88
+ bin_1_sum_effect <- marginal_effect(bin_1_sum,
89
+ newdata = dat_2015_s, family = "logit",
90
+ main_var = "pop_15_44_muni_gendergap_2015",
91
+ difference = TRUE,
92
+ treat_range = c(1, 1.2))
93
+
94
+ bin_1_p_effect <- marginal_effect(bin_1_p,
95
+ newdata = dat_s, family = "logit",
96
+ main_var = "pop_15_44_muni_gendergap_2015",
97
+ difference = TRUE,
98
+ treat_range = c(1, 1.2))
99
+
100
+ # Point estimate
101
+ round(bin_1_sum_effect$out_main[1:3]*100, 2)
102
+ # 2.5% 97.5%
103
+ # 0.88 2.60 4.19
104
+ round(bin_1_p_effect$out_main[1:3]*100, 2)
105
+ # 2.5% 97.5%
106
+ # 0.76 1.71 2.55
107
+
108
+
109
+ ## Comparing to round(bin_1_sum_effect$out_main[1:3]*100, 2)
110
+ ## The Effect of Unemployment
111
+ effect_unemp <- marginal_effect(bin_1_sum,
112
+ newdata = dat_2015_s, family = "logit",
113
+ main_var = "log_unemp_all_muni_2015",
114
+ difference = TRUE,
115
+ treat_range = quantile(dat_2015_s$log_unemp_all_muni_2015, prob = c(0.2, 0.8),
116
+ na.rm = TRUE))
117
+ round(effect_unemp$out_main[1:3]*100, 2) # 2.60 is more than half of 4.24
118
+
119
+ ## The Effect of Education
120
+ effect_educ <- marginal_effect(bin_1_sum,
121
+ newdata = dat_2015_s, family = "logit",
122
+ main_var = "pc_hidegree_all2011",
123
+ difference = TRUE,
124
+ treat_range = quantile(dat_2015_s$pc_hidegree_all2011, prob = c(0.8, 0.2),
125
+ na.rm = TRUE))
126
+ round(effect_educ$out_main[1:3]*100, 2)
127
+ # 2.60 is more than twice of 1.20
128
+
129
+
130
+ # Correlation between Excess Males and Male Disadvantage
131
+ round(cor(dat_2015_s$pop_15_44_muni_gendergap_2015, dat_2015_s$unemp_gendergap_2015, use = "complete.obs"), 3)
132
+
133
+
134
+ # ###############
135
+ # Sub Section: Mate Competition and Support for Anti-Refugee Hate Crime
136
+ # ###############
137
+ rm(list=ls())
138
+ # install.packages("readstata13") # readstata13_0.9.2
139
+ # install.packages("MASS") # MASS_7.3-51.6
140
+ # install.packages("sandwich") # sandwich_2.5-1
141
+ # install.packages("lmtest") # lmtest_0.9-37
142
+ # install.packages("pBrackets") # pBrackets_1.0
143
+ # install.packages("stargazer") # stargazer_5.2.2
144
+
145
+ require(readstata13) # readstata13_0.9.2
146
+ require(MASS) # MASS_7.3-51.6
147
+ require(sandwich) # sandwich_2.5-1
148
+ require(lmtest) # lmtest_0.9-37
149
+ require(pBrackets) # pBrackets_1.0
150
+ require(stargazer) # stargazer_5.2.2
151
+ source("Help.R")
152
+
153
+ dat <- read.dta13(file = "survey.dta")
154
+
155
+ # Subset to people in the wave 4
156
+ dat_use <- dat[dat$wave == 4, ]
157
+
158
+ # Prepare Two data sets
159
+ dat_male <- dat_use[dat_use$gender == "Male" & dat_use$age <= 44 & dat_use$age >= 18, ]
160
+ dat_male_y <- dat_use[dat_use$gender == "Male" & dat_use$age <= 40 & dat_use$age >= 30, ]
161
+
162
+ # Overall Samples
163
+ dat_use$MateComp.cont_bin <- ifelse(dat_use$MateComp.cont >= 3, 1, 0)
164
+ dat_use$excess_c <- ifelse(dat_use$pop_15_44_muni_gendergap_2015 < 1.04, "1",
165
+ ifelse(dat_use$pop_15_44_muni_gendergap_2015 < 1.12, "2", "3"))
166
+ mean_all <- tapply(dat_use$MateComp.cont_bin, dat_use$excess_c, mean)
167
+ se_all <- tapply(dat_use$MateComp.cont_bin, dat_use$excess_c, sd)/sqrt(table(dat_use$excess_c))
168
+
169
+ # Male (18 - 44)
170
+ dat_male$MateComp.cont_bin <- ifelse(dat_male$MateComp.cont >= 3, 1, 0)
171
+ dat_male$excess_c <- ifelse(dat_male$pop_15_44_muni_gendergap_2015 < 1.04, "1",
172
+ ifelse(dat_male$pop_15_44_muni_gendergap_2015 < 1.12, "2", "3"))
173
+ mean_all_m <- tapply(dat_male$MateComp.cont_bin, dat_male$excess_c, mean)
174
+ se_all_m <- tapply(dat_male$MateComp.cont_bin, dat_male$excess_c, sd)/sqrt(table(dat_male$excess_c))
175
+
176
+ # Male (30 - 40)
177
+ dat_male_y$MateComp.cont_bin <- ifelse(dat_male_y$MateComp.cont >= 3, 1, 0)
178
+ dat_male_y$excess_c <- ifelse(dat_male_y$pop_15_44_muni_gendergap_2015 < 1.04, "1",
179
+ ifelse(dat_male_y$pop_15_44_muni_gendergap_2015 < 1.12, "2", "3"))
180
+ mean_all_y <- tapply(dat_male_y$MateComp.cont_bin, dat_male_y$excess_c, mean)
181
+ se_all_y <- tapply(dat_male_y$MateComp.cont_bin, dat_male_y$excess_c, sd)/sqrt(table(dat_male_y$excess_c))
182
+
183
+
184
+ round(mean_all,2)[c(1,3)] ## 0.18 0.22
185
+ round(mean_all_m,2)[c(1,3)] ## 0.23 0.38
186
+ round(mean_all_y,2)[c(1,3)] ## 0.17 0.47
187
+
188
+ # ################
189
+ # List Experiment
190
+ # ###############
191
+ rm(list=ls())
192
+ # install.packages("readstata13") # readstata13_0.9.2
193
+ # install.packages("MASS") # MASS_7.3-51.6
194
+ # install.packages("sandwich") # sandwich_2.5-1
195
+ # install.packages("lmtest") # lmtest_0.9-37
196
+ # install.packages("list") # list_9.2
197
+
198
+ require(readstata13) # readstata13_0.9.2
199
+ require(MASS) # MASS_7.3-51.6
200
+ require(sandwich) # sandwich_2.5-1
201
+ require(lmtest) # lmtest_0.9-37
202
+ require(list) # list_9.2
203
+
204
+ dat <- read.dta13(file = "survey.dta")
205
+ data.u2 <- dat[dat$wave == 2, ]
206
+
207
+ # Means: When it comes to the refugee problem, violence is sometimes the only means that citizens have to get the attention of German politicians
208
+ data.list.u2 <- data.u2[data.u2$list == "1",]
209
+ data.direct.u2 <- data.u2[data.u2$list == "2",]
210
+ data.list.u2 <- data.list.u2[is.na(data.list.u2$treatment_list)==FALSE,]
211
+ data.list.u2$List.treat <- ifelse(data.list.u2$treatment_list == "Scenario 2", 1, 0)
212
+
213
+ # The mean for Control Group
214
+ round(mean(data.list.u2$outcome_list[data.list.u2$List.treat == 0]), 2)
215
+ # The mean for Treatment Group
216
+ round(mean(data.list.u2$outcome_list[data.list.u2$List.treat == 1]), 2)
217
+ # Please see "SurveyAnalysis_Main.R" for complete analysis, which was used to create Figure 3.
218
+ # Here, we only reproduce the code for numbers we mention in the paper.
219
+
220
+ ## Compare to All People who answered Direct Question (n = 2170)
221
+ data.u2.all.direct <- data.u2[is.na(data.u2$hate_violence_means) == FALSE, ]
222
+ data.u2.all.direct$hate.direct.bin <- ifelse(data.u2.all.direct$hate_violence_means >=3, 1, 0)
223
+ round(mean(data.u2.all.direct$hate.direct.bin)*100) ## 18
32/replication_package/out_count_table.rdata ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ccd234462ece80c73745d90e9e27c76c646e09715a4f23e4f875725a6006dd5
3
+ size 10955242
32/replication_package/produce_context_data.do ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *************************************************************
2
+ *Purpose: Merge context data and generate additional vars
3
+ *Stata Version: 16
4
+ *************************************************************
5
+
6
+ *-------------------------------
7
+ *generate merged_context_1.dta
8
+ *-------------------------------
9
+ use "source_data/unemployment.dta", clear
10
+
11
+ *unemployment gendergap
12
+ *----------------------
13
+ gen unemp_gendergap = unemp_men/unemp_female
14
+ label var unemp_gendergap "male unemployment rate / female unemployment rate"
15
+
16
+ rename ags_dist ags_county // "county" and "district" used as synonyms
17
+ label var ags_c " Identifier for County"
18
+ save "source_data/merged_context_1.dta",replace
19
+
20
+ *-----------------------------
21
+ *generate merged_context_2.dta
22
+ *-----------------------------
23
+
24
+ *unemployment data
25
+ *-------------------
26
+ use "source_data/unemployment.dta", clear
27
+
28
+ gen unemp_gendergap = unemp_men/unemp_female
29
+ label var unemp_gendergap "male unemployment rate / female unemployment rate"
30
+
31
+ save "source_data/temp1.dta", replace
32
+
33
+ *refugees by gender
34
+ *-------------------
35
+ use "source_data/refugee_gender.dta", clear
36
+
37
+ egen ref_male = rowtotal(all_male0_3 all_male3_6 all_male6_15 all_male15_18 all_male18_25 all_male25_30 all_male30_40 all_male40_50 all_male50_65 all_male65_75 all_male75_up)
38
+ gen pc_ref_male = ref_male*100/all_totref
39
+ label var pc_ref_male "% male refugees, of all refugees"
40
+ label var ref_male "total number of male refugees (all ages)"
41
+
42
+ save "source_data/temp2.dta", replace
43
+
44
+ *education
45
+ *----------
46
+ use "source_data/education.dta", clear
47
+
48
+ *high degree
49
+ gen pc_hidegree_all2011 = pop15_high_degree*100/pop15_total
50
+ label var pc_hidegree_all2011 "% population with university entrance exam, incl. still in school" // (census 2011)
51
+
52
+ save "source_data/temp3.dta", replace
53
+
54
+
55
+ * sector
56
+ *--------
57
+ use "source_data/sectors.dta", clear
58
+
59
+ gen pc_manufacturing = no_manufacturing/no_employed
60
+ label var pc_manufacturing "pc_manufacturing"
61
+
62
+ save "source_data/temp4.dta", replace
63
+
64
+ *merge data
65
+ *----------
66
+ /*
67
+ this is a more comprehensive dataset - start by using a master data file
68
+ that includes the ags year combinations we need
69
+ */
70
+
71
+ use "source_data/population.dta"
72
+
73
+ merge 1:1 ags year using "source_data/temp1.dta" // unemployment
74
+ drop _m
75
+ merge 1:1 ags year using "source_data/temp2.dta" // refugees
76
+ drop _m
77
+ merge m:1 ags using "source_data/temp3.dta" // education in 2011 this m:1 merge
78
+ drop _m
79
+ merge 1:1 ags year using "source_data/temp4.dta" //sectors
80
+ drop _m
81
+
82
+ rename ags_dist ags_county // "county" and "district" used as synonyms
83
+ label var ags_c " Identifier for County"
84
+
85
+ save "source_data/merged_context_2.dta",replace
86
+ erase "source_data/temp1.dta"
87
+ erase "source_data/temp2.dta"
88
+ erase "source_data/temp3.dta"
89
+ erase "source_data/temp4.dta"
32/replication_package/source_context.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f795cd86bfb2e74eef85962eca903471790639cd848c998934406a6208d6eed3
3
+ size 157393
32/replication_package/source_context_placebo.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a93779e37456c5055ae0b1386564fbba9616c1c8669176130110fd177dedc88
3
+ size 180992
32/replication_package/source_data/area_mun.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fbbc3f1c2ef170246e40c6b32ce440b9d60aaae466c89f51a8d81ba278988b2e
3
+ size 765299
32/replication_package/source_data/base.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5af5c1de4f9362caa1eb1fe0233241b34f721512416bf8daa79a69fd79ec66a
3
+ size 844133
32/replication_package/source_data/base_pl.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da54848f03aae66e23beef62ef0edd781f03869355c09408b72c31d002b65fba
3
+ size 694698
32/replication_package/source_data/crime.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d93d6b20b821852be117c8715e33636ac432aeaf2314d20eedca14107b66573
3
+ size 21664
32/replication_package/source_data/education.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fee3371a6aa2fbdb92bf1bfd861f0d460f2eb55daa9d9f5f08e1dc47cac50865
3
+ size 39650
32/replication_package/source_data/hate.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17d13a62e1abead6692c79bb476766e41e6fd64701be85c14549f77afeb6130d
3
+ size 2143165
32/replication_package/source_data/merged_context_1.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2df0c90bf9b8e38d80bab08f85de2b3f87df05861233b2deb276c3ed9162e7b9
3
+ size 241539
32/replication_package/source_data/merged_context_2.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf108efd04187720950b11bb72d30c929a26ae6ffa4ba009bafc37694f2d3cad
3
+ size 1323816
32/replication_package/source_data/pop_gemeinde_2008_2018.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d80379610f6d011650aee5a4e8d5e289a626460ae568dd7feae5f6257bbb27d5
3
+ size 77180609
32/replication_package/source_data/pop_kreise_2015_2017.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea3561218aa950bd9c682d3d242ab979e9d5bc23177e7ea6d268468a0ce7c958
3
+ size 26488
32/replication_package/source_data/population.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7fe4cba1be98e195be54a00e5a827d5b1e2fda56093054bcafa22f2ec909a93
3
+ size 46987
32/replication_package/source_data/refugee_gender.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b2126acb78af60c555ccaebbe1c024401569df114540b0a9ab47d61da06f264
3
+ size 127827
32/replication_package/source_data/refugees_2008_2017.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8fc45783e4a4f51ba663d22f766b5fe56639a075ae9c5f9b9e635602632f4118
3
+ size 1380624
32/replication_package/source_data/sectors.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5bca2f44da65dee4c54c9ff2804b69b6a911715ae96a59198a0f6a367a93f456
3
+ size 488307
32/replication_package/source_data/unempl_gemeinde_2008_2017.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4c2ba9d7c5964f1671530e94d565bc029b2355dbd0e1dc78ef4a82ab0b948be
3
+ size 8082440
32/replication_package/source_data/unemployment.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:714cc77c4840d0fa99a155e2dd7498b2b0c6a63a4effe64381adf44b82a59513
3
+ size 231439
32/replication_package/source_data/voting.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7be35304a013490ee92c5fbb6dedc75032dc731f70eaab99833448f8b0186fb9
3
+ size 1705216
32/replication_package/survey.dta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40d6fa1133cfe63c006fc7d37c89a0980f1cf2559fa83537d0ac4339b314fc6e
3
+ size 4702645
32/replication_package/table1.tex ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:30:28
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lcccccc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{6}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-7}
12
+ \\[-1.8ex] & \multicolumn{5}{c}{hate\_violence\_means} & formula.6 \\
13
+ \\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6)\\
14
+ \hline \\[-1.8ex]
15
+ Mate Competition & 0.437$^{***}$ & 0.263$^{***}$ & 0.236$^{***}$ & 0.206$^{***}$ & 0.185$^{***}$ & 0.155$^{***}$ \\
16
+ & (0.016) & (0.020) & (0.021) & (0.019) & (0.019) & (0.019) \\
17
+ & & & & & & \\
18
+ Job Competition & & 0.250$^{***}$ & 0.236$^{***}$ & 0.077$^{***}$ & 0.065$^{***}$ & 0.056$^{***}$ \\
19
+ & & (0.019) & (0.019) & (0.020) & (0.020) & (0.019) \\
20
+ & & & & & & \\
21
+ Life Satisfaction & & $-$0.015$^{**}$ & $-$0.014$^{*}$ & $-$0.003 & $-$0.002 & $-$0.0001 \\
22
+ & & (0.006) & (0.007) & (0.006) & (0.006) & (0.006) \\
23
+ & & & & & & \\
24
+ \hline \\[-1.8ex]
25
+ Observations & 3,019 & 3,019 & 3,008 & 3,008 & 3,008 & 3,008 \\
26
+ R$^{2}$ & 0.191 & 0.240 & 0.288 & 0.394 & 0.410 & 0.459 \\
27
+ Adjusted R$^{2}$ & 0.191 & 0.240 & 0.267 & 0.371 & 0.382 & 0.431 \\
28
+ Residual Std. Error & 0.799 (df = 3017) & 0.775 (df = 3015) & 0.760 (df = 2921) & 0.704 (df = 2897) & 0.698 (df = 2873) & 0.670 (df = 2857) \\
29
+ F Statistic & 714.588$^{***}$ (df = 1; 3017) & 317.891$^{***}$ (df = 3; 3015) & 13.756$^{***}$ (df = 86; 2921) & 17.141$^{***}$ (df = 110; 2897) & 14.878$^{***}$ (df = 134; 2873) & 16.170$^{***}$ (df = 150; 2857) \\
30
+ \hline
31
+ \hline \\[-1.8ex]
32
+ \textit{Note:} & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
33
+ \end{tabular}
34
+ \end{table}
32/replication_package/table_C1.tex ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:32:51
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lcccccc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{6}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-7}
12
+ \\[-1.8ex] & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin \\
13
+ \\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6)\\
14
+ \hline \\[-1.8ex]
15
+ Excess Males (Age 15 - 44) & 2.127$^{***}$ & 2.132$^{***}$ & 1.598$^{***}$ & 1.549$^{***}$ & 1.406$^{***}$ & 1.537$^{***}$ \\
16
+ & (0.491) & (0.432) & (0.491) & (0.411) & (0.463) & (0.412) \\
17
+ & & & & & & \\
18
+ Log (Population) & 1.730$^{***}$ & 1.519$^{***}$ & 1.619$^{***}$ & 1.392$^{***}$ & 1.522$^{***}$ & 1.372$^{***}$ \\
19
+ & (0.056) & (0.041) & (0.060) & (0.044) & (0.055) & (0.042) \\
20
+ & & & & & & \\
21
+ Log (Population Density) & 0.098 & 0.087$^{*}$ & 0.052 & 0.039 & 0.017 & $-$0.002 \\
22
+ & (0.070) & (0.052) & (0.070) & (0.051) & (0.066) & (0.049) \\
23
+ & & & & & & \\
24
+ Log (Unemployment Rate) & & & 1.087$^{***}$ & 1.028$^{***}$ & 0.634$^{***}$ & 0.715$^{***}$ \\
25
+ & & & (0.180) & (0.142) & (0.156) & (0.130) \\
26
+ & & & & & & \\
27
+ % of population change (2011 vs 2015) & & & $-$0.617 & $-$0.235 & $-$0.299 & 0.020 \\
28
+ & & & (0.975) & (0.608) & (0.851) & (0.541) \\
29
+ & & & & & & \\
30
+ Vote share for AfD (2013) & & & 5.618$^{*}$ & 4.822$^{**}$ & 5.358 & 3.178 \\
31
+ & & & (3.116) & (2.406) & (3.384) & (2.718) \\
32
+ & & & & & & \\
33
+ Log (Refugee Inflow) (2014 vs 2015) & & & & & 0.857$^{***}$ & 0.734$^{***}$ \\
34
+ & & & & & (0.324) & (0.261) \\
35
+ & & & & & & \\
36
+ Log (Refugee Size) (2014) & & & & & $-$0.210$^{**}$ & $-$0.192$^{**}$ \\
37
+ & & & & & (0.104) & (0.084) \\
38
+ & & & & & & \\
39
+ Log (General Violence per capita) & & & & & 0.136 & 0.022 \\
40
+ & & & & & (0.189) & (0.151) \\
41
+ & & & & & & \\
42
+ % of High Education & & & & & $-$0.022$^{*}$ & $-$0.018$^{*}$ \\
43
+ & & & & & (0.013) & (0.011) \\
44
+ & & & & & & \\
45
+ Change in Manufacturing Share (2011 vs 2015) & & & & & 8.177$^{**}$ & 9.588$^{***}$ \\
46
+ & & & & & (4.062) & (3.167) \\
47
+ & & & & & & \\
48
+ Share of Manufacturing & & & & & 0.057 & $-$0.306 \\
49
+ & & & & & (0.750) & (0.606) \\
50
+ & & & & & & \\
51
+ Male Disadvantage & & & & & 0.920$^{**}$ & 0.846$^{***}$ \\
52
+ & & & & & (0.371) & (0.319) \\
53
+ & & & & & & \\
54
+ \hline \\[-1.8ex]
55
+ Observations & 10,307 & 30,921 & 10,029 & 30,087 & 9,282 & 27,846 \\
56
+ Log Likelihood & $-$2,813.561 & $-$5,645.573 & $-$2,771.915 & $-$5,487.582 & $-$2,776.250 & $-$5,290.740 \\
57
+ Akaike Inf. Crit. & 6,433.122 & 12,101.150 & 6,141.830 & 11,577.160 & 5,600.500 & 10,633.480 \\
58
+ \hline
59
+ \hline \\[-1.8ex]
60
+ \textit{Note:} & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
61
+ \end{tabular}
62
+ \end{table}
32/replication_package/table_C2.tex ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:35:11
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lcccccc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{6}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-7}
12
+ \\[-1.8ex] & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin \\
13
+ \\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6)\\
14
+ \hline \\[-1.8ex]
15
+ Excess Males (Age 25 - 44) & 1.595$^{***}$ & 1.794$^{***}$ & 0.958$^{**}$ & 1.066$^{***}$ & 0.932$^{**}$ & 1.192$^{***}$ \\
16
+ & (0.454) & (0.400) & (0.456) & (0.373) & (0.430) & (0.364) \\
17
+ & & & & & & \\
18
+ Log (Population) & 1.726$^{***}$ & 1.511$^{***}$ & 1.614$^{***}$ & 1.387$^{***}$ & 1.518$^{***}$ & 1.365$^{***}$ \\
19
+ & (0.056) & (0.041) & (0.059) & (0.043) & (0.054) & (0.042) \\
20
+ & & & & & & \\
21
+ Log (Population Density) & 0.082 & 0.073 & 0.030 & 0.019 & 0.001 & $-$0.014 \\
22
+ & (0.070) & (0.052) & (0.070) & (0.051) & (0.066) & (0.049) \\
23
+ & & & & & & \\
24
+ Log (Unemployment Rate) & & & 1.120$^{***}$ & 1.039$^{***}$ & 0.642$^{***}$ & 0.704$^{***}$ \\
25
+ & & & (0.184) & (0.145) & (0.157) & (0.131) \\
26
+ & & & & & & \\
27
+ % of population change (2011 vs 2015) & & & $-$0.463 & $-$0.023 & $-$0.207 & 0.156 \\
28
+ & & & (0.905) & (0.554) & (0.816) & (0.511) \\
29
+ & & & & & & \\
30
+ Vote share for AfD (2013) & & & 5.974$^{*}$ & 5.282$^{**}$ & 5.776$^{*}$ & 3.771 \\
31
+ & & & (3.088) & (2.400) & (3.366) & (2.699) \\
32
+ & & & & & & \\
33
+ Log (Refugee Inflow) (2014 vs 2015) & & & & & 0.859$^{***}$ & 0.705$^{***}$ \\
34
+ & & & & & (0.324) & (0.263) \\
35
+ & & & & & & \\
36
+ Log (Refugee Size) (2014) & & & & & $-$0.211$^{**}$ & $-$0.191$^{**}$ \\
37
+ & & & & & (0.103) & (0.084) \\
38
+ & & & & & & \\
39
+ Log (General Violence per capita) & & & & & 0.130 & 0.019 \\
40
+ & & & & & (0.187) & (0.149) \\
41
+ & & & & & & \\
42
+ % of High Education & & & & & $-$0.022$^{*}$ & $-$0.018$^{*}$ \\
43
+ & & & & & (0.013) & (0.010) \\
44
+ & & & & & & \\
45
+ Change in Manufacturing Share (2011 vs 2015) & & & & & 8.213$^{**}$ & 9.464$^{***}$ \\
46
+ & & & & & (4.029) & (3.139) \\
47
+ & & & & & & \\
48
+ Share of Manufacturing & & & & & 0.076 & $-$0.318 \\
49
+ & & & & & (0.748) & (0.603) \\
50
+ & & & & & & \\
51
+ Male Disadvantage & & & & & 0.910$^{**}$ & 0.856$^{***}$ \\
52
+ & & & & & (0.369) & (0.316) \\
53
+ & & & & & & \\
54
+ \hline \\[-1.8ex]
55
+ Observations & 10,378 & 31,134 & 10,097 & 30,291 & 9,288 & 27,864 \\
56
+ Log Likelihood & $-$2,823.656 & $-$5,669.987 & $-$2,781.008 & $-$5,512.023 & $-$2,782.381 & $-$5,312.211 \\
57
+ Akaike Inf. Crit. & 6,453.312 & 12,149.970 & 6,160.016 & 11,626.050 & 5,612.761 & 10,676.420 \\
58
+ \hline
59
+ \hline \\[-1.8ex]
60
+ \textit{Note:} & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
61
+ \end{tabular}
62
+ \end{table}
32/replication_package/table_C3.tex ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:35:27
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lcccccc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{6}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-7}
12
+ \\[-1.8ex] & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin \\
13
+ \\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6)\\
14
+ \hline \\[-1.8ex]
15
+ Excess Males (Age 15 - 44) & 0.116$^{***}$ & 0.069$^{***}$ & 0.089$^{***}$ & 0.051$^{***}$ & 0.095$^{***}$ & 0.057$^{***}$ \\
16
+ & (0.027) & (0.015) & (0.025) & (0.013) & (0.026) & (0.014) \\
17
+ & & & & & & \\
18
+ Log (Population) & 0.162$^{***}$ & 0.086$^{***}$ & 0.156$^{***}$ & 0.081$^{***}$ & 0.152$^{***}$ & 0.078$^{***}$ \\
19
+ & (0.009) & (0.005) & (0.008) & (0.004) & (0.008) & (0.004) \\
20
+ & & & & & & \\
21
+ Log (Population Density) & 0.011 & 0.011$^{***}$ & 0.010 & 0.011$^{***}$ & 0.008 & 0.008$^{**}$ \\
22
+ & (0.007) & (0.004) & (0.007) & (0.003) & (0.007) & (0.003) \\
23
+ & & & & & & \\
24
+ Log (Unemployment Rate) & & & 0.137$^{***}$ & 0.090$^{***}$ & 0.093$^{***}$ & 0.066$^{***}$ \\
25
+ & & & (0.015) & (0.009) & (0.014) & (0.008) \\
26
+ & & & & & & \\
27
+ % of population change (2011 vs 2015) & & & $-$0.059 & $-$0.031 & 0.024 & 0.025 \\
28
+ & & & (0.086) & (0.041) & (0.100) & (0.050) \\
29
+ & & & & & & \\
30
+ Vote share for AfD (2013) & & & 0.307$^{**}$ & 0.120$^{*}$ & 0.370$^{**}$ & 0.106 \\
31
+ & & & (0.147) & (0.069) & (0.182) & (0.089) \\
32
+ & & & & & & \\
33
+ Log (Refugee Inflow) (2014 vs 2015) & & & & & 0.075 & 0.046 \\
34
+ & & & & & (0.051) & (0.029) \\
35
+ & & & & & & \\
36
+ Log (Refugee Size) (2014) & & & & & $-$0.019 & $-$0.011 \\
37
+ & & & & & (0.014) & (0.007) \\
38
+ & & & & & & \\
39
+ Log (General Violence per capita) & & & & & 0.010 & 0.007 \\
40
+ & & & & & (0.021) & (0.011) \\
41
+ & & & & & & \\
42
+ % of High Education & & & & & $-$0.003$^{*}$ & $-$0.002$^{**}$ \\
43
+ & & & & & (0.002) & (0.001) \\
44
+ & & & & & & \\
45
+ Change in Manufacturing Share (2011 vs 2015) & & & & & 0.725 & 0.583$^{**}$ \\
46
+ & & & & & (0.489) & (0.243) \\
47
+ & & & & & & \\
48
+ Share of Manufacturing & & & & & 0.021 & $-$0.023 \\
49
+ & & & & & (0.092) & (0.048) \\
50
+ & & & & & & \\
51
+ Male Disadvantage & & & & & 0.114$^{**}$ & 0.063$^{**}$ \\
52
+ & & & & & (0.047) & (0.025) \\
53
+ & & & & & & \\
54
+ \hline \\[-1.8ex]
55
+ Observations & 10,307 & 30,921 & 10,029 & 30,087 & 9,282 & 27,846 \\
56
+ R$^{2}$ & 0.366 & 0.252 & 0.347 & 0.204 & 0.302 & 0.180 \\
57
+ Adjusted R$^{2}$ & 0.340 & 0.242 & 0.327 & 0.196 & 0.301 & 0.179 \\
58
+ Residual Std. Error & 0.316 (df = 9904) & 0.247 (df = 30516) & 0.314 (df = 9730) & 0.246 (df = 29786) & 0.320 (df = 9258) & 0.248 (df = 27820) \\
59
+ F Statistic & 14.206$^{***}$ (df = 402; 9904) & 25.480$^{***}$ (df = 404; 30516) & 17.368$^{***}$ (df = 298; 9730) & 25.406$^{***}$ (df = 300; 29786) & 174.490$^{***}$ (df = 23; 9258) & 244.318$^{***}$ (df = 25; 27820) \\
60
+ \hline
61
+ \hline \\[-1.8ex]
62
+ \textit{Note:} & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
63
+ \end{tabular}
64
+ \end{table}
32/replication_package/table_C4.tex ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:38:34
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lcccccc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{6}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-7}
12
+ \\[-1.8ex] & Physical\_muni\_1517\_bin & Physical\_muni\_bin & Physical\_muni\_1517\_bin & Physical\_muni\_bin & Physical\_muni\_1517\_bin & Physical\_muni\_bin \\
13
+ \\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6)\\
14
+ \hline \\[-1.8ex]
15
+ Excess Males (Age 15 - 44) & 3.773$^{***}$ & 3.038$^{***}$ & 2.624$^{***}$ & 1.906$^{**}$ & 2.719$^{***}$ & 1.634$^{*}$ \\
16
+ & (0.938) & (0.818) & (0.910) & (0.744) & (0.944) & (0.902) \\
17
+ & & & & & & \\
18
+ Log (Population) & 1.775$^{***}$ & 1.640$^{***}$ & 1.562$^{***}$ & 1.429$^{***}$ & 1.442$^{***}$ & 1.366$^{***}$ \\
19
+ & (0.120) & (0.090) & (0.124) & (0.100) & (0.106) & (0.101) \\
20
+ & & & & & & \\
21
+ Log (Population Density) & 0.096 & 0.071 & 0.080 & 0.045 & 0.046 & $-$0.018 \\
22
+ & (0.134) & (0.109) & (0.129) & (0.103) & (0.113) & (0.105) \\
23
+ & & & & & & \\
24
+ Log (Unemployment Rate) & & & 1.591$^{***}$ & 1.515$^{***}$ & 1.179$^{***}$ & 1.309$^{***}$ \\
25
+ & & & (0.346) & (0.304) & (0.282) & (0.256) \\
26
+ & & & & & & \\
27
+ % of population change (2011 vs 2015) & & & $-$0.837 & $-$0.368 & 0.023 & 0.154 \\
28
+ & & & (0.772) & (0.721) & (0.580) & (0.555) \\
29
+ & & & & & & \\
30
+ Vote share for AfD (2013) & & & 2.058 & 0.875 & 0.588 & 0.763 \\
31
+ & & & (6.640) & (6.184) & (5.209) & (5.080) \\
32
+ & & & & & & \\
33
+ Log (Refugee Inflow) (2014 vs 2015) & & & & & 0.262 & $-$0.091 \\
34
+ & & & & & (0.686) & (0.646) \\
35
+ & & & & & & \\
36
+ Log (Refugee Size) (2014) & & & & & $-$0.429$^{**}$ & $-$0.288 \\
37
+ & & & & & (0.210) & (0.202) \\
38
+ & & & & & & \\
39
+ Log (General Violence per capita) & & & & & $-$0.303 & $-$0.288 \\
40
+ & & & & & (0.383) & (0.383) \\
41
+ & & & & & & \\
42
+ % of High Education & & & & & $-$0.011 & $-$0.018 \\
43
+ & & & & & (0.024) & (0.023) \\
44
+ & & & & & & \\
45
+ Change in Manufacturing Share (2011 vs 2015) & & & & & 4.548 & $-$0.633 \\
46
+ & & & & & (8.376) & (8.393) \\
47
+ & & & & & & \\
48
+ Share of Manufacturing & & & & & 1.859 & 2.050 \\
49
+ & & & & & (1.742) & (1.632) \\
50
+ & & & & & & \\
51
+ Male Disadvantage & & & & & 1.258 & 1.217 \\
52
+ & & & & & (0.800) & (0.786) \\
53
+ & & & & & & \\
54
+ \hline \\[-1.8ex]
55
+ Observations & 10,307 & 30,921 & 10,029 & 30,087 & 9,282 & 27,846 \\
56
+ Log Likelihood & $-$842.859 & $-$1,447.433 & $-$820.949 & $-$1,339.173 & $-$884.639 & $-$1,339.369 \\
57
+ Akaike Inf. Crit. & 2,491.718 & 3,704.866 & 2,239.899 & 3,280.346 & 1,817.279 & 2,730.737 \\
58
+ \hline
59
+ \hline \\[-1.8ex]
60
+ \textit{Note:} & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
61
+ \end{tabular}
62
+ \end{table}
32/replication_package/table_C5.tex ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:38:36
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lcc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{2}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-3}
12
+ \\[-1.8ex] & Hate\_all\_muni\_1517 & Hate\_all\_muni \\
13
+ \\[-1.8ex] & (1) & (2)\\
14
+ \hline \\[-1.8ex]
15
+ Excess Males (Age 15 - 44) & 1.150$^{***}$ & 1.246$^{***}$ \\
16
+ & (0.366) & (0.363) \\
17
+ & & \\
18
+ Log (Population) & 1.264$^{***}$ & 1.249$^{***}$ \\
19
+ & (0.039) & (0.038) \\
20
+ & & \\
21
+ Log (Population Density) & $-$0.032 & $-$0.030 \\
22
+ & (0.045) & (0.045) \\
23
+ & & \\
24
+ Log (Unemployment Rate) & 0.703$^{***}$ & 0.729$^{***}$ \\
25
+ & (0.131) & (0.129) \\
26
+ & & \\
27
+ % of population change (2011 vs 2015) & 0.072 & 0.096 \\
28
+ & (0.508) & (0.457) \\
29
+ & & \\
30
+ Vote share for AfD (2013) & 4.464$^{*}$ & 4.088 \\
31
+ & (2.670) & (2.670) \\
32
+ & & \\
33
+ Log (Refugee Inflow) (2014 vs 2015) & 0.588$^{**}$ & 0.541$^{**}$ \\
34
+ & (0.280) & (0.272) \\
35
+ & & \\
36
+ Log (Refugee Size) (2014) & $-$0.189$^{**}$ & $-$0.180$^{*}$ \\
37
+ & (0.093) & (0.093) \\
38
+ & & \\
39
+ Log (General Violence per capita) & 0.034 & $-$0.016 \\
40
+ & (0.161) & (0.165) \\
41
+ & & \\
42
+ % of High Education & $-$0.017 & $-$0.017$^{*}$ \\
43
+ & (0.011) & (0.011) \\
44
+ & & \\
45
+ Change in Manufacturing Share (2011 vs 2015) & 10.081$^{***}$ & 10.432$^{***}$ \\
46
+ & (3.333) & (3.452) \\
47
+ & & \\
48
+ Share of Manufacturing & $-$0.028 & $-$0.035 \\
49
+ & (0.651) & (0.632) \\
50
+ & & \\
51
+ Male Disadvantage & 0.617$^{*}$ & 0.656$^{*}$ \\
52
+ & (0.337) & (0.345) \\
53
+ & & \\
54
+ \hline \\[-1.8ex]
55
+ Observations & 9,282 & 27,846 \\
56
+ Log Likelihood & $-$5,125.037 & $-$7,759.071 \\
57
+ $\theta$ & 1.247$^{***}$ (0.088) & 0.842$^{***}$ (0.053) \\
58
+ Akaike Inf. Crit. & 10,298.070 & 15,570.140 \\
59
+ \hline
60
+ \hline \\[-1.8ex]
61
+ \textit{Note:} & \multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
62
+ \end{tabular}
63
+ \end{table}
32/replication_package/table_C6.tex ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:38:37
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lcccc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{4}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-5}
12
+ \\[-1.8ex] & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin \\
13
+ \\[-1.8ex] & (1) & (2) & (3) & (4)\\
14
+ \hline \\[-1.8ex]
15
+ Excess Males (Age 15 - 44) & 1.291$^{***}$ & 1.442$^{***}$ & 1.588$^{**}$ & 1.445$^{**}$ \\
16
+ & (0.462) & (0.410) & (0.791) & (0.701) \\
17
+ & & & & \\
18
+ West & 0.075 & $-$0.124 & 0.542 & $-$0.119 \\
19
+ & (0.161) & (0.118) & (1.063) & (0.913) \\
20
+ & & & & \\
21
+ Log (Population) & 1.484$^{***}$ & 1.340$^{***}$ & 1.485$^{***}$ & 1.340$^{***}$ \\
22
+ & (0.046) & (0.039) & (0.046) & (0.039) \\
23
+ & & & & \\
24
+ Log (Population Density) & 0.046 & 0.030 & 0.046 & 0.030 \\
25
+ & (0.061) & (0.048) & (0.061) & (0.048) \\
26
+ & & & & \\
27
+ Log (Unemployment Rate) & 0.585$^{***}$ & 0.653$^{***}$ & 0.577$^{***}$ & 0.653$^{***}$ \\
28
+ & (0.148) & (0.124) & (0.151) & (0.128) \\
29
+ & & & & \\
30
+ % of population change (2011 vs 2015) & 0.050 & 0.308 & 0.072 & 0.308 \\
31
+ & (0.772) & (0.499) & (0.765) & (0.497) \\
32
+ & & & & \\
33
+ Vote share for AfD (2013) & 3.865 & 3.183 & 3.860 & 3.183 \\
34
+ & (3.223) & (2.624) & (3.223) & (2.625) \\
35
+ & & & & \\
36
+ Log (Refugee Inflow) (2014 vs 2015) & 1.475$^{***}$ & 1.282$^{***}$ & 1.471$^{***}$ & 1.282$^{***}$ \\
37
+ & (0.326) & (0.247) & (0.328) & (0.247) \\
38
+ & & & & \\
39
+ Log (Refugee Size) (2014) & $-$0.397$^{***}$ & $-$0.386$^{***}$ & $-$0.396$^{***}$ & $-$0.386$^{***}$ \\
40
+ & (0.094) & (0.079) & (0.094) & (0.079) \\
41
+ & & & & \\
42
+ Log (General Violence per capita) & 0.083 & $-$0.092 & 0.086 & $-$0.092 \\
43
+ & (0.166) & (0.138) & (0.166) & (0.139) \\
44
+ & & & & \\
45
+ % of High Education & $-$0.027$^{**}$ & $-$0.021$^{**}$ & $-$0.027$^{**}$ & $-$0.021$^{**}$ \\
46
+ & (0.012) & (0.010) & (0.012) & (0.010) \\
47
+ & & & & \\
48
+ Change in Manufacturing Share (2011 vs 2015) & 7.554$^{*}$ & 8.568$^{**}$ & 7.560$^{*}$ & 8.568$^{**}$ \\
49
+ & (4.241) & (3.509) & (4.247) & (3.509) \\
50
+ & & & & \\
51
+ Share of Manufacturing & $-$0.332 & $-$0.611 & $-$0.337 & $-$0.611 \\
52
+ & (0.666) & (0.504) & (0.666) & (0.505) \\
53
+ & & & & \\
54
+ Male Disadvantage & 1.077$^{***}$ & 1.015$^{***}$ & 1.084$^{***}$ & 1.016$^{***}$ \\
55
+ & (0.369) & (0.317) & (0.370) & (0.318) \\
56
+ & & & & \\
57
+ Excess Males x West & & & $-$0.419 & $-$0.004 \\
58
+ & & & (0.938) & (0.812) \\
59
+ & & & & \\
60
+ \hline \\[-1.8ex]
61
+ Observations & 9,282 & 27,846 & 9,282 & 27,846 \\
62
+ Log Likelihood & $-$2,790.647 & $-$5,310.629 & $-$2,790.555 & $-$5,310.629 \\
63
+ Akaike Inf. Crit. & 5,611.295 & 10,655.260 & 5,613.110 & 10,657.260 \\
64
+ \hline
65
+ \hline \\[-1.8ex]
66
+ \textit{Note:} & \multicolumn{4}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
67
+ \end{tabular}
68
+ \end{table}
32/replication_package/table_C7.tex ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:38:38
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lcc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{2}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-3}
12
+ \\[-1.8ex] & Hate\_all\_muni\_1517\_bin & Hate\_all\_muni\_bin \\
13
+ \\[-1.8ex] & (1) & (2)\\
14
+ \hline \\[-1.8ex]
15
+ Excess Males (Age 15 - 44) & $-$8.441 & $-$17.754 \\
16
+ & (18.923) & (15.168) \\
17
+ & & \\
18
+ Log (Refugee Inflow) (2014 vs 2015) & $-$0.544 & $-$2.018 \\
19
+ & (2.711) & (2.185) \\
20
+ & & \\
21
+ Log (Population) & 1.522$^{***}$ & 1.372$^{***}$ \\
22
+ & (0.055) & (0.042) \\
23
+ & & \\
24
+ Log (Population Density) & 0.019 & 0.001 \\
25
+ & (0.066) & (0.049) \\
26
+ & & \\
27
+ Log (Unemployment Rate) & 0.630$^{***}$ & 0.708$^{***}$ \\
28
+ & (0.155) & (0.130) \\
29
+ & & \\
30
+ % of population change (2011 vs 2015) & $-$0.299 & 0.017 \\
31
+ & (0.856) & (0.548) \\
32
+ & & \\
33
+ Vote share for AfD (2013) & 5.358 & 3.192 \\
34
+ & (3.386) & (2.726) \\
35
+ & & \\
36
+ Log (Refugee Size) (2014) & $-$0.209$^{**}$ & $-$0.190$^{**}$ \\
37
+ & (0.104) & (0.085) \\
38
+ & & \\
39
+ Log (General Violence per capita) & 0.141 & 0.035 \\
40
+ & (0.190) & (0.152) \\
41
+ & & \\
42
+ % of High Education & $-$0.022$^{*}$ & $-$0.019$^{*}$ \\
43
+ & (0.013) & (0.011) \\
44
+ & & \\
45
+ Change in Manufacturing Share (2011 vs 2015) & 8.200$^{**}$ & 9.647$^{***}$ \\
46
+ & (4.077) & (3.200) \\
47
+ & & \\
48
+ Share of Manufacturing & 0.044 & $-$0.335 \\
49
+ & (0.750) & (0.606) \\
50
+ & & \\
51
+ Male Disadvantage & 0.929$^{**}$ & 0.865$^{***}$ \\
52
+ & (0.372) & (0.321) \\
53
+ & & \\
54
+ Excess Males × Log (Refugee Inflow) & 1.290 & 2.524 \\
55
+ & (2.477) & (1.987) \\
56
+ & & \\
57
+ \hline \\[-1.8ex]
58
+ Observations & 9,282 & 27,846 \\
59
+ Log Likelihood & $-$2,776.125 & $-$5,289.906 \\
60
+ Akaike Inf. Crit. & 5,602.249 & 10,633.810 \\
61
+ \hline
62
+ \hline \\[-1.8ex]
63
+ \textit{Note:} & \multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
64
+ \end{tabular}
65
+ \end{table}
32/replication_package/table_C9.tex ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:38:39
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lccccc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{5}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-6}
12
+ \\[-1.8ex] & \multicolumn{5}{c}{Hate\_all\_muni\_bin} \\
13
+ \\[-1.8ex] & (1) & (2) & (3) & (4) & (5)\\
14
+ \hline \\[-1.8ex]
15
+ Future-Treatment & $-$1.326 & 0.480 & 0.544 & $-$0.277 & $-$0.243 \\
16
+ & (1.551) & (1.061) & (1.592) & (0.773) & (1.043) \\
17
+ & & & & & \\
18
+ \hline \\[-1.8ex]
19
+ Observations & 8,939 & 8,681 & 8,679 & 26,299 & 13,147 \\
20
+ Log Likelihood & $-$1,366.904 & $-$2,312.448 & $-$1,546.793 & $-$5,284.379 & $-$4,558.570 \\
21
+ Akaike Inf. Crit. & 2,783.807 & 4,674.896 & 3,143.587 & 10,622.760 & 9,171.140 \\
22
+ \hline
23
+ \hline \\[-1.8ex]
24
+ \textit{Note:} & \multicolumn{5}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
25
+ \end{tabular}
26
+ \end{table}
32/replication_package/table_D5_1.tex ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
3
+ % Date and time: Wed, Sep 09, 2020 - 23:38:46
4
+ \begin{table}[!htbp] \centering
5
+ \caption{}
6
+ \label{}
7
+ \begin{tabular}{@{\extracolsep{5pt}}lccccc}
8
+ \\[-1.8ex]\hline
9
+ \hline \\[-1.8ex]
10
+ & \multicolumn{5}{c}{\textit{Dependent variable:}} \\
11
+ \cline{2-6}
12
+ \\[-1.8ex] & formula.7.means & formula.7.justified & formula.7.message & formula.7.prevent & formula.7.condemn \\
13
+ \\[-1.8ex] & (1) & (2) & (3) & (4) & (5)\\
14
+ \hline \\[-1.8ex]
15
+ Mate Competition & 0.155$^{***}$ & 0.173$^{***}$ & 0.192$^{***}$ & 0.204$^{***}$ & 0.027 \\
16
+ & (0.019) & (0.019) & (0.019) & (0.018) & (0.021) \\
17
+ & & & & & \\
18
+ Job Competition & 0.056$^{***}$ & 0.050$^{***}$ & 0.097$^{***}$ & 0.087$^{***}$ & 0.017 \\
19
+ & (0.019) & (0.019) & (0.019) & (0.018) & (0.021) \\
20
+ & & & & & \\
21
+ Life Satisfaction & $-$0.0001 & $-$0.009 & $-$0.004 & $-$0.011$^{*}$ & $-$0.007 \\
22
+ & (0.006) & (0.006) & (0.006) & (0.006) & (0.007) \\
23
+ & & & & & \\
24
+ \hline \\[-1.8ex]
25
+ Observations & 3,008 & 3,008 & 3,008 & 3,008 & 3,008 \\
26
+ R$^{2}$ & 0.459 & 0.453 & 0.448 & 0.469 & 0.347 \\
27
+ Adjusted R$^{2}$ & 0.431 & 0.424 & 0.419 & 0.441 & 0.313 \\
28
+ Residual Std. Error (df = 2857) & 0.670 & 0.683 & 0.679 & 0.643 & 0.745 \\
29
+ F Statistic (df = 150; 2857) & 16.170$^{***}$ & 15.746$^{***}$ & 15.462$^{***}$ & 16.814$^{***}$ & 10.136$^{***}$ \\
30
+ \hline
31
+ \hline \\[-1.8ex]
32
+ \textit{Note:} & \multicolumn{5}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
33
+ \end{tabular}
34
+ \end{table}