Let’s see how different neighborhood matrix styles can impact the estimates of spatial regression models. Run the code below in order to have the data in place for this exercise. (You can ignore any warning messages.)

voting_districts <-
  sf::st_read("./data/Stimmbezirk.shp") %>%
  sf::st_transform(3035)  %>% 
  dplyr::transmute(Stimmbezirk = as.numeric(nummer))

afd_votes <-
  glue::glue(
    "https://www.stadt-koeln.de/wahlen/bundestagswahl/09-2021/praesentation/\\
    Open-Data-Bundestagswahl476.csv"
  ) %>% 
  readr::read_csv2() %>%
  dplyr::transmute(Stimmbezirk = `gebiet-nr`, afd_share = (F1 / F) * 100)

election_results <-
  dplyr::left_join(
    voting_districts,
    afd_votes,
    by = "Stimmbezirk"
  )

immigrants_cologne <-
  z11::z11_get_100m_attribute(STAATSANGE_KURZ_2) %>%
  terra::crop(election_results) %>%
  terra::mask(terra::vect(election_results))


inhabitants_cologne <-
  z11::z11_get_100m_attribute(Einwohner) %>%
  terra::crop(election_results) %>%
  terra::mask(terra::vect(election_results))

immigrant_share_cologne <-
  (immigrants_cologne / inhabitants_cologne) * 100

election_results <-
  election_results %>%
  dplyr::mutate(
    immigrant_share = 
      exactextractr::exact_extract(immigrant_share_cologne, ., 'mean'),
    inhabitants = 
      exactextractr::exact_extract(inhabitants_cologne, ., 'mean')
  )

1

Re-use the code from the previous exercise for the Queen neighborhoods. But this time, do one weight matrix with row-normalization and another one with minmax-normalization. Insert them into two spatial regression lag models of your choice using the same variables as in the lecture, i.e., both of them should either be a Spatial Lag Y or Spatial Lag X model.
For minmax-normalization, you would have to use the option style = "minmax" in the spdep:nb2listw() function.

2

Calculate the impacts of both models. What is your observation?