whereby _yict_ is the outcome of person _i_ who resided in county _c_ in 2015, and whose outcomes we see in year _t_ . To isolate the variation within person over time, we condition on a set of individual and year fixed effects, _αi_ and _αt_ , which absorb time-invariant individual characteristics as well as changes in the outcome that are common to all individuals. The county fixed effects also control for the pre-2014 number of asylum seekers in a county, which remained stable until the mass inflow 2015. The regressor of interest is the interaction between the inflow of asylum seekers and a _post_ dummy that equals unity in all years after 2015 and zero in years until 2014. Given the implicit control for the base level of asylum seekers, the coefficient _β_ is identified from variation across counties in the change in the number of asylum relative to the number before 2014. In other words, by including fixed effects, we estimate our coefficient of interest by comparing counties with a similar number of asylum seekers before 2014 but different increases in the number of asylum seekers in 2015/16.

The error term _εict_ captures all the determinants of the outcome that are not captured by the fixed effects. To account for serial as well as spatial correlation in the error terms of people living in the same county, we cluster the standard errors at the county level.

Our coefficient of interest is _β_ , which captures the effect of a 100% increase in the number of asylum seekers in a county on the probability that our outcome takes value one after 2015 relative to that person’s outcome before 2015. For instance, when the outcome is trust, an estimate _β_ of 0.01 means that doubling the number of asylum seekers in a person’s county of residence increases the likelihood that the person agrees that people can be trusted by one percentage point.

The coefficient _β_ can only be interpreted as causal under the so-called parallel trends assumption. It requires that, in absence of the refugee inflows, perceptions would have evolved the same way in high- and low-inflow areas. In other words, if we saw a gap in perceptions opening up after 2015, the assumption is that this gap is only due to the refugee inflows. This is an important advantage of a difference-in-difference design compared to cross-sectional analyses: the difference-in-difference design does require the assumption that the inflow of immigrants be as good as random.

Although the parallel trends assumption is not testable, we argue that it plausibly holds in the German context. For everyone involved, a sudden inflow of one million asylum seekers was completely unexpected. Within a few weeks, German states were forced to find accommodation, which is why many states deviated from their policy to assign asylum seekers to municipalities based on population size and often assigned them based on the availability of suitable buildings. This procedure often led to assignments that were independent of local conditions. Moreover, asylum seekers cannot choose their initial place of residence, which excludes a typical identification challenge of studies on immigration, namely that migrants deliberately choose to settle in a particular place.

# **4.2.2 Anti-immigrant violence**

To estimate the effect of the inflow of refugees and asylum seekers on violent behaviours against immigrants, we use data from the Antonio Amadeu Foundation. Our dataset allows us to follow the monthly evolution of anti-immigrant violence in Germany between 2014 and the end of 2017.

20