class: center, middle, inverse, title-slide .title[ # Introduction to Geospatial Techniques for Social Scientists in R ] .subtitle[ ## Spatial Econometrics & Outlook ] .author[ ### Stefan Jünger & Anne-Kathrin Stroppe ] .institute[ ###
GESIS Workshop
] .date[ ### April 24, 2024 ] --- layout: true --- ## Now <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> April 24 </td> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;background-color: yellow !important;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## What are spatial econometrics? Econometrics could be reduced to using statistics to model (complex) theories ... - it is interesting for causal inference and thinking - as default we think about regression analysis Therefore, spatial econometrics combine spatial analysis and econometrics - study of why spatial relationships (i.e., autocorrelation) exist - how spatial autocorrelation affects our outcome of interest **What is the data generation process?** --- ## Spatial diffusion vs. spatial spillover There are at least two common mechanisms we are interested in spatial econometrics .pull-left[ .small[ **Diffusion** - `\(y_i\)` affects `\(y_j\)` through `\(w_{ij}\)` - `\(y_j\)` affects `\(y_i\)` through `\(w_{ji}\)` - that's a feedback effect - endogenous by design! - Examples: - pandemic and policy measures to contain the pandemic - diffusion of violence in a war ] ] .pull-right[ .small[ **Spillover** - `\(x_i\)` affects `\(y_j\)` through `\(w_{ij}\)` - `\(x_j\)` affects `\(y_i\)` through `\(w_{ij}\)` - Examples: - spillover of economic strength and trade ] ] --- ## Let's have another look at our chessboard .pull-left[ We have to think about theories and mechanisms and how they translate into spatial effects and the data generation process. That said, there are tests to check for the specific data generation process at hand, but they are not recommended to be used naively. ] .pull-right[ .center[ <img src="data:image/png;base64,#../img/queen_interdependent.png" width="3464" style="display: block; margin: auto;" /> ] ] --- ## Is it meaningful or just nuisances? Space can be important in our analysis in two ways. - it's meaningful in our theory and we thus interpret it accordingly after estimation - it can distort our empirical estimates, producing bias, inconsistency, and inefficiency **We can address both of these different perspectives in our analysis with spatial econometric methods.** --- ## Formulas... models, models, models Linear Regression: `$$Y = X\beta + \epsilon$$` -- Spatial Lag Y / Spatial Autoregressive Model (SAR, Diffusion): `$$Y = \rho WY + X\beta + \epsilon$$` -- Spatial Lag X Model (SLX, Spillover): `$$Y = X\beta + WX\theta + \epsilon$$` -- Spatial Error Model (SEM): `$$Y = X\beta + u$$` `$$u = \lambda Wu + \epsilon$$` --- ## Flavors and extensions .tinyisher[ Spatial Durbin Model: $$Y = \rho WY + X\beta + WX\theta + \epsilon $$ ] .tinyisher[ Spatial Durbin Error Model: `$$Y = X\beta + WX\theta + u$$` `$$u = \lambda Wu + \epsilon$$` ] .tinyisher[ Combined Spatial Autocorrelation Model: `$$Y = \rho WY + X\beta + u$$` `$$u = \lambda Wu + \epsilon$$` ] .tinyisher[ Manski Model: `$$Y = \rho WY + WX\theta + X\beta + u$$` `$$u = \lambda Wu + \epsilon$$` ] .center[ <img src="data:image/png;base64,#../img/formulas.gif" width="40%" style="display: block; margin: auto;" /> .tinyisher[ Source:[Tenor](https://tenor.com/de/view/formulas-hangover-gif-4841358) ] ] --- ## Intermediate summary There are a lot of models you could estimate to *explain* spatial autocorrelation. And there's a vast body of literature on what's the best choice for which application. We'd explicitly like to recommend the work of [Tobias Rüttenauer](https://ruettenauer.github.io/publication/) for us social scientists. [Here](https://ruettenauer.github.io/SICSS-Spatial/index.html) are some really nice workshop materials. **In this session, we will only estimate Spatial Lag Y and X and Spatial Error Models.** --- ## 'Research' question and data We will use the same example as in the previous session. But this time, we will actually test if one of our spatial regression models helps investigating the data generation process any further. We may ask: 1. Do immigrant shares have an effect on AfD voting shares within voting districts? 2. Do immigrant shares have an effect on AfD voting shares between neighborhoods? (=spillover) 3. Do AfD voting shares have an effect on AfD voting shares between neighborhoods? (=diffusion) It might also be a good idea to control for inhabitant numbers within the voting districts. --- ## Linear regression ```r linear_regression <- lm(afd_share ~ immigrant_share + inhabitants, data = election_results) summary(linear_regression) ``` ``` ## ## Call: ## lm(formula = afd_share ~ immigrant_share + inhabitants, data = election_results) ## ## Residuals: ## Min 1Q Median 3Q Max ## -15.010 -3.397 -0.232 2.790 25.032 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 27.737242 0.579582 47.857 < 2e-16 *** ## immigrant_share -0.097675 0.026150 -3.735 0.000207 *** ## inhabitants -0.079595 0.003812 -20.879 < 2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 4.843 on 540 degrees of freedom ## Multiple R-squared: 0.4822, Adjusted R-squared: 0.4803 ## F-statistic: 251.4 on 2 and 540 DF, p-value: < 2.2e-16 ``` --- ## Now we need a spatial weight To estimate a spatial regression we, once again, have to construct a spatial weight as in the analysis of spatial autocorrelation. In fact, we'll use the same approach as before. ```r queen_neighborhoods <- spdep::poly2nb(election_results, queen = TRUE) queen_W <- spdep::nb2listw(queen_neighborhoods, style = "W") ``` --- ## Spatial Error Model: If we want to control nuisance .small[ ```r spatial_error_model <- spatialreg::errorsarlm( afd_share ~ immigrant_share + inhabitants, data = election_results, listw = queen_W ) summary(spatial_error_model) ``` ``` ## ## Call: ## spatialreg::errorsarlm(formula = afd_share ~ immigrant_share + ## inhabitants, data = election_results, listw = queen_W) ## ## Residuals: ## Min 1Q Median 3Q Max ## -9.60213 -2.38063 -0.40782 1.97417 25.55441 ## ## Type: error ## Coefficients: (asymptotic standard errors) ## Estimate Std. Error z value Pr(>|z|) ## (Intercept) 22.8185498 0.9398113 24.2799 < 2.2e-16 ## immigrant_share -0.0806095 0.0281025 -2.8684 0.004125 ## inhabitants -0.0337644 0.0045643 -7.3974 1.388e-13 ## ## Lambda: 0.75749, LR test value: 216.39, p-value: < 2.22e-16 ## Asymptotic standard error: 0.033094 ## z-value: 22.889, p-value: < 2.22e-16 ## Wald statistic: 523.9, p-value: < 2.22e-16 ## ## Log likelihood: -1517.349 for error model ## ML residual variance (sigma squared): 13.532, (sigma: 3.6785) ## Number of observations: 543 ## Number of parameters estimated: 5 ## AIC: NA (not available for weighted model), (AIC for lm: 3259.1) ``` ] --- ## Spatial Lag X Model: estimating spillovers .small[ ```r spatial_lag_x_model <- spatialreg::lmSLX( afd_share ~ immigrant_share + inhabitants, data = election_results, listw = queen_W ) summary(spatial_lag_x_model) ``` ``` ## ## Call: ## lm(formula = formula(paste("y ~ ", paste(colnames(x)[-1], collapse = "+"))), ## data = as.data.frame(x), weights = weights) ## ## Residuals: ## Min 1Q Median 3Q Max ## -10.4243 -3.0311 -0.1935 2.4388 25.0694 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 30.649157 0.671665 45.632 < 2e-16 *** ## immigrant_share -0.069702 0.034623 -2.013 0.0446 * ## inhabitants -0.026439 0.005841 -4.526 7.4e-06 *** ## lag.immigrant_share -0.026168 0.048127 -0.544 0.5869 ## lag.inhabitants -0.085389 0.007656 -11.153 < 2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 4.364 on 538 degrees of freedom ## Multiple R-squared: 0.5811, Adjusted R-squared: 0.578 ## F-statistic: 186.6 on 4 and 538 DF, p-value: < 2.2e-16 ``` ] --- ## Spatial Lag Y Model: estimating diffusion .small[ ```r spatial_lag_y_model <- spatialreg::lagsarlm( afd_share ~ immigrant_share + inhabitants, data = election_results, listw = queen_W) summary(spatial_lag_y_model) ``` ``` ## ## Call: ## spatialreg::lagsarlm(formula = afd_share ~ immigrant_share + ## inhabitants, data = election_results, listw = queen_W) ## ## Residuals: ## Min 1Q Median 3Q Max ## -10.17786 -2.27359 -0.29956 1.98212 24.26683 ## ## Type: lag ## Coefficients: (asymptotic standard errors) ## Estimate Std. Error z value Pr(>|z|) ## (Intercept) 10.2465884 0.9782773 10.4741 < 2.2e-16 ## immigrant_share -0.0527021 0.0196904 -2.6765 0.007439 ## inhabitants -0.0330830 0.0034265 -9.6551 < 2.2e-16 ## ## Rho: 0.66446, LR test value: 261.11, p-value: < 2.22e-16 ## Asymptotic standard error: 0.03489 ## z-value: 19.045, p-value: < 2.22e-16 ## Wald statistic: 362.69, p-value: < 2.22e-16 ## ## Log likelihood: -1494.985 for lag model ## ML residual variance (sigma squared): 12.992, (sigma: 3.6045) ## Number of observations: 543 ## Number of parameters estimated: 5 ## AIC: 3000, (AIC for lm: 3259.1) ## LM test for residual autocorrelation ## test value: 21.043, p-value: 4.4919e-06 ``` ] --- ## Comparison: What's 'better'? .small[ ```r AIC(spatial_error_model, spatial_lag_x_model, spatial_lag_y_model) ``` ``` ## df AIC ## spatial_error_model 5 3044.697 ## spatial_lag_x_model 6 3147.995 ## spatial_lag_y_model 5 2999.971 ``` ```r spdep::lm.LMtests(linear_regression, queen_W, test = c("LMerr", "LMlag")) ``` ``` ## ## Lagrange multiplier diagnostics for spatial dependence ## ## data: ## model: lm(formula = afd_share ~ immigrant_share + ## inhabitants, data = election_results) ## weights: queen_W ## ## LMerr = 198.29, df = 1, p-value < 2.2e-16 ## ## ## Lagrange multiplier diagnostics for spatial dependence ## ## data: ## model: lm(formula = afd_share ~ immigrant_share + ## inhabitants, data = election_results) ## weights: queen_W ## ## LMlag = 299.73, df = 1, p-value < 2.2e-16 ``` ] Let's stick to our theory, shall we? --- ## Of higher importance: interpretation Unfortunately, in case of a Spatial Lag Y Model the spatial parameter `\(\rho\)` only tells us that the effect is (statistically) significant -- or not. - remember: these models are endegenous by design - we have effects of `\(y_j\)` on `\(y_i\)` and vice versa - what a mess Luckily, there's a method to decompose the spatial effects into direct, indirect and total effects: **estimating impacts** --- ## Impact estimation in `R` This time, let's start with the Spatial Lag Y Model: ```r spatialreg::impacts(spatial_lag_y_model, listw = queen_W) ``` ``` ## Impact measures (lag, exact): ## Direct Indirect Total ## immigrant_share -0.05948993 -0.09757580 -0.15706572 ## inhabitants -0.03734396 -0.06125182 -0.09859578 ``` Compare it to the 'simple' regression output: ```r coef(spatial_lag_y_model) ``` ``` ## rho (Intercept) immigrant_share inhabitants ## 0.66445817 10.24658839 -0.05270212 -0.03308301 ``` --- ## Spatial Lag X impacts ```r spatialreg::impacts(spatial_lag_x_model, listw = queen_W) ``` ``` ## Impact measures (SlX, glht): ## Direct Indirect Total ## immigrant_share -0.06970227 -0.02616764 -0.09586991 ## inhabitants -0.02643886 -0.08538884 -0.11182770 ``` Compare it to the 'simple' regression output: ```r coef(spatial_lag_x_model) ``` ``` ## (Intercept) immigrant_share inhabitants ## 30.64915652 -0.06970227 -0.02643886 ## lag.immigrant_share lag.inhabitants ## -0.02616764 -0.08538884 ``` --- ## If you need p-values and stuff ```r spatialreg::impacts(spatial_lag_y_model, listw = queen_W, R = 500) %>% summary(zstats = TRUE, short = TRUE) ``` ``` ## Impact measures (lag, exact): ## Direct Indirect Total ## immigrant_share -0.05948993 -0.09757580 -0.15706572 ## inhabitants -0.03734396 -0.06125182 -0.09859578 ## ======================================================== ## Simulation results ( variance matrix): ## ======================================================== ## Simulated standard errors ## Direct Indirect Total ## immigrant_share 0.022390179 0.038273065 0.059658509 ## inhabitants 0.003535946 0.008409926 0.009944576 ## ## Simulated z-values: ## Direct Indirect Total ## immigrant_share -2.661032 -2.575303 -2.650849 ## inhabitants -10.629243 -7.405056 -10.041695 ## ## Simulated p-values: ## Direct Indirect Total ## immigrant_share 0.0077901 0.010015 0.008029 ## inhabitants < 2.22e-16 1.3101e-13 < 2e-16 ``` --- class: middle ## Exercise 2_3_2: Spatial Regression [Exercise](https://stefanjuenger.github.io/gesis-workshop-geospatial-techniques-R-2024/exercises/2_4_1_Spatial_Regression.html) [Solution](https://stefanjuenger.github.io/gesis-workshop-geospatial-techniques-R-2024/solutions/2_4_1_Spatial_Regression.html) --- class: middle ## Outlook --- ## This week <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Introduction <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> April 23 </td> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;background-color: yellow !important;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Introduction Main Messages - Geospatial data are relevant in the social sciences - already for a long time - `R` can serve as a full-blown Geographic Information System (GIS) --- ## Vector Data <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> April 23 </td> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;background-color: yellow !important;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Vector Data Main Messages - Most common geospatial data type - Vector data come as points, lines or polygons - Information on the geometries stored in the geometry column - Attributes can be assigned to each geometric object - Attribute tables are treated as data frames --- ## Mapping <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> April 23 </td> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;background-color: yellow !important;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Mapping Main Messages - the basis of each map is the geometries of geospatial data - spatial distribution of attributes becomes visible when defining an attribute and adding color scales - layer shapefiles to add more information or for aesthetic reasons --- ## Raster Data <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solidbackground-color: yellow !important;"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solidbackground-color: yellow !important;"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solidbackground-color: yellow !important;"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Raster Data Main Messages - Data format for efficient and fast analysis of geospatial data - flexible in their application - can get rather involved - however, straightforward extraction of values --- ## Advanced Data Import <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> April 24 </td> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;background-color: yellow !important;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Advanced Data Import Main Messages - Geospatial data tend to be large - Often distributed over the internet - APIs help in downloading these data - can get pretty involved --- ## Applied Data Wrangling <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> April 24 </td> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;background-color: yellow !important;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Applied Data Wrangling Main Messages - Georeferenced survey data require handling sensitive data - our example of wrangling and linking data, but applications may vary - spatial joins are the perfect tool to add geospatial information to other georeferenced data --- ## Investigating Spatial Autocorrelation <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> April 24 </td> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;background-color: yellow !important;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Investigating Spatial Autocorrelation Main Messages - spatial autocorrelation is something that must be detected - we need a model for that - spatial weight matrices! - there are global and local indicators of spatial autocorrelation --- ## Spatial Econometrics <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Day </th> <th style="text-align:left;"> Time </th> <th style="text-align:left;"> Title </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 10:00-11:30 </td> <td style="text-align:left;font-weight: bold;"> Introduction to GIS </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 11:45-13:00 </td> <td style="text-align:left;font-weight: bold;"> Vector Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 13:00-14:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 23 </td> <td style="text-align:left;color: gray !important;"> 14:00-15:30 </td> <td style="text-align:left;font-weight: bold;"> Mapping </td> </tr> <tr> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> April 23 </td> <td style="text-align:left;color: gray !important;border-bottom: 1px solid"> 15:45-17:00 </td> <td style="text-align:left;font-weight: bold;border-bottom: 1px solid"> Raster Data </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 09:00-10:30 </td> <td style="text-align:left;font-weight: bold;"> Advanced Data Import & Processing </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 10:45-12:00 </td> <td style="text-align:left;font-weight: bold;"> Applied Data Wrangling & Linking </td> </tr> <tr> <td style="text-align:left;color: gray !important;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;color: gray !important;"> 12:00-13:00 </td> <td style="text-align:left;font-weight: bold;color: gray !important;"> Lunch Break </td> </tr> <tr> <td style="text-align:left;color: gray !important;"> April 24 </td> <td style="text-align:left;color: gray !important;"> 13:00-14:30 </td> <td style="text-align:left;font-weight: bold;"> Investigating Spatial Autocorrelation </td> </tr> <tr> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> April 24 </td> <td style="text-align:left;color: gray !important;background-color: yellow !important;"> 14:45-16:00 </td> <td style="text-align:left;font-weight: bold;background-color: yellow !important;"> Spatial Econometrics & Outlook </td> </tr> </tbody> </table> --- ## Spatial Econometrics Main Messages - spatial autocorrelation can also be explained by - diffusion - or spillover effect - these effects can be tested but should always be inspected with theory --- ## What's left .pull-left[ .small[ Other map types such as - cartograms - hexagon maps - animated maps - (more) network graphs GIS techniques, such as - geocoding - routing - cluster analysis More Advanced Spatial(-temporal) Modeling More data sources... ] ] .pull-right[ <img src="data:image/png;base64,#../img/kontakt.gif" width="100%" style="display: block; margin: auto;" /> .tinyisher[ Check out [`gganimate`](https://github.com/thomasp85/gganimate) ] ] --- ## Data Sources Some more information: - geospatial data are interdisciplinary - amount of data feels unlimited - data providers and data portals are often specific in the area and/or the information they cover -- Some random examples: - [Eurostat](https://ec.europa.eu/eurostat/web/gisco/geodata) - [European Spatial Data Infrastructure](https://inspire.ec.europa.eu/about-inspire/563) - [John Hopkins Corona Data Hub and Dashboard](https://coronavirus.jhu.edu/map.html) - [US Census Bureau](https://www.census.gov/geographies/mapping-files/time-series/geo/carto-boundary-file.html) - ... --- class: middle ## The End --- class: middle ## Addon-slides: Missings in Spatial Econometrics --- ## What if you got missing values? Missing values in spatial regression models do produce similar problems as in ordinary regression analysis - yield biased estimates - reduces statistical power However, the issue gets a bit more severe as the observations interdependent - we are missing out on more information - even randomness of missings might get problematic - **Thus, it might be a good idea to think of methods to navigate this bias.** --- ## Let's produce a dataset with missing data .pull-left[ ```r # ~10% missing values missing_index <- sample( 1:nrow(election_results), round(nrow(election_results) * .1, 0) ) election_results_missing <- election_results election_results_missing$afd_share[missing_index] <- NA # list-wise deletion election_results_missing <- na.omit(election_results_missing) tm_shape(election_results_missing) + tm_fill("afd_share", palette = "viridis") ``` ] .pull-right[ .center[ <img src="data:image/png;base64,#2_4_Spatial_Econometrics_Outlook_files/figure-html/missing-elections-2-1.png" style="display: block; margin: auto;" /> ] ] --- ## How does a Spatial Lag X Model perform? ```r queen_neighborhoods_missing <- spdep::poly2nb(election_results_missing, queen = TRUE) queen_W_missing <- spdep::nb2listw(queen_neighborhoods_missing, style = "W", zero.policy = TRUE) spatial_lag_y_model_missing <- spatialreg::lagsarlm( afd_share ~ immigrant_share + inhabitants, data = election_results_missing, listw = queen_W_missing, zero.policy = TRUE ) ``` --- ## Model comparison ```r spatialreg::impacts(spatial_lag_y_model_missing, listw = queen_W_missing) ``` ``` ## Impact measures (lag, exact): ## Direct Indirect Total ## immigrant_share -0.05450334 -0.07883944 -0.13334278 ## inhabitants -0.03918632 -0.05668327 -0.09586959 ``` ```r spatialreg::impacts(spatial_lag_y_model, listw = queen_W) ``` ``` ## Impact measures (lag, exact): ## Direct Indirect Total ## immigrant_share -0.05948993 -0.09757580 -0.15706572 ## inhabitants -0.03734396 -0.06125182 -0.09859578 ``` --- ## What to do now? The way how to deal with missing data in geospatial data depends on their general geometric structure. For points, there are established methods, such as [interpolation](https://keen-swartz-3146c4.netlify.app/interpolation.html). Often these are somewhat ways of aggregating data, which does not help in our case. I'd say that good old imputation techniques might also help: - good for multivariate cases - yet, they are no spatial techniques and cannot create plausible values for spatial relationships - but imputing spatial relationships would be a matter of contingency anyway --- ## Simplest case of imputation .pull-left[ ```r # ~10% missing values missing_index <- sample( 1:nrow(election_results), round(nrow(election_results) * .1, 0) ) election_results_missing <- election_results election_results_missing$afd_share[missing_index] <- NA election_results_missing <- election_results_missing %>% sf::st_drop_geometry() %>% mice::mice(method = "norm.predict", m = 1) %>% mice::complete() %>% dplyr::left_join( election_results_missing %>% dplyr::select(-afd_share, -immigrant_share, -inhabitants) ) %>% sf::st_as_sf() ``` ] .pull-right[ .center[ ``` ## ## iter imp variable ## 1 1 afd_share ## 2 1 afd_share ## 3 1 afd_share ## 4 1 afd_share ## 5 1 afd_share ``` <img src="data:image/png;base64,#2_4_Spatial_Econometrics_Outlook_files/figure-html/impute-2-1.png" style="display: block; margin: auto;" /> ] ] --- ## And again run the model ```r queen_neighborhoods_missing <- spdep::poly2nb(election_results_missing, queen = TRUE) queen_W_missing <- spdep::nb2listw(queen_neighborhoods_missing, style = "W") spatial_lag_y_model_missing <- spatialreg::lagsarlm( afd_share ~ immigrant_share + inhabitants, data = election_results_missing, listw = queen_W_missing ) ``` --- ## ...and compare it with the original one ```r spatialreg::impacts(spatial_lag_y_model_missing, listw = queen_W_missing) ``` ``` ## Impact measures (lag, exact): ## Direct Indirect Total ## immigrant_share -0.04834610 -0.06855918 -0.1169053 ## inhabitants -0.04148773 -0.05883338 -0.1003211 ``` ```r spatialreg::impacts(spatial_lag_y_model, listw = queen_W) ``` ``` ## Impact measures (lag, exact): ## Direct Indirect Total ## immigrant_share -0.05948993 -0.09757580 -0.15706572 ## inhabitants -0.03734396 -0.06125182 -0.09859578 ``` --- layout: false class: center background-image: url(data:image/png;base64,#../assets/img/the_end.png) background-size: cover .left-column[ </br> <img src="data:image/png;base64,#../img/Anne.png" width="75%" style="display: block; margin: auto;" /> ] .right-column[ .left[.small[<svg viewBox="0 0 512 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm0 48v40.805c-22.422 18.259-58.168 46.651-134.587 106.49-16.841 13.247-50.201 45.072-73.413 44.701-23.208.375-56.579-31.459-73.413-44.701C106.18 199.465 70.425 171.067 48 152.805V112h416zM48 400V214.398c22.914 18.251 55.409 43.862 104.938 82.646 21.857 17.205 60.134 55.186 103.062 54.955 42.717.231 80.509-37.199 103.053-54.947 49.528-38.783 82.032-64.401 104.947-82.653V400H48z"></path> </svg> [anne-kathrin.stroppe@gesis.org](mailto:anne-kathrin.stroppe@gesis.org)] .small[<svg viewBox="0 0 512 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path> </svg> [`@astroppe`](https://twitter.com/stroppann)] .small[<svg viewBox="0 0 496 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path> </svg> [`stroppann`](https://github.com/stroppann)] .small[<svg viewBox="0 0 576 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"></path> </svg> [`NA`](NA)]] ]