Overview
Let’s use some of the skills we put into practice to examine the subnational relationship between development and conflict in Nigeria.
In this breakout, we’ll:
- Overlay different shape files to build a sub-national map of Nigeria.
- Map conflict locations onto grid cell locations.
- Generate a subnational choropleth map of conflict intensity.
- Correlate conflict intensity with nightlight intensity (a proxy for sub-national economic development).
Data
We’ll use the following spatial datasets for this project:
- ACLED Conflict Event Data for location data on events related to instability.
- About the data: ACLED is a “disaggregated data collection, analysis, and crisis mapping project. ACLED collects the dates, actors, locations, fatalities, and modalities of all reported political violence and protest events across Africa, South Asia, Southeast Asia, the Middle East, Central Asia and the Caucasus, Latin America and the Caribbean, and Southeastern and Eastern Europe and the Balkans.” For this exercise, we’ll focus just on the data pertaining to Africa. For more information regarding these data, please consult the ACLED methodology.
- Prio-Grid data pertaining to African states.
- About the data: The PRIO-GRID dataset is a grid structure that aids the compilation, management and analysis of spatial data within a time-consistent framework. It consists of quadratic grid cells that jointly cover all terrestrial areas of the world. Each grid cell contains cell-specific information on armed conflicts, socio-economic conditions, ethnic groups, physical attributes, climatic conditions and more.
- Added to the grid shape file is information on nighttime lights, which captures the level of light pollution within a prio-grid unit. Values represent the gridcell average of the cloud-free composites made using all the available archived DMSP-OLS smooth resolution data for 1992 - 2012 calendar years.
- Country shape file of Nigeria.
The data can be downloaded from the following Dropbox data transfer link.
# Load relevant packages
require(tidyverse)
require(patchwork)
require(ggthemes)
require(sf)
Tasks
(1) Import and Prepare the Data
Read in the Nigeria country shape file, prio grid shape file, and the acled conflict (.csv
) data.
In addition, do the following:
- Subset the acled data so that we only consider events that occurred in Nigeria. Also, only consider events where the geo-precision code (
geo_precision
) equals 1
(that is, events where we are confident about where the location of the event took place).
- Convert the location information (
longitude
and latitude
) for the Nigeria Acled data into a simple features geometry.
(2) Visual Check
Plot the three spatial data objects as separate plots. Combine the three separate plots into a single plot using patchwork
.
(3) Subset the Prio-Grid data
Subset the Prio-Grid data to only capture grid locations that intersect with Nigeria. (Note: it’s okay if the grid locations fall outside the Nigeria spatial boundary.)
As visual check, plot the Nigeria map layering on the subsetted grid features. Make sure to use the alpha
argument to make the grid map features transparent.
(4) Overlay the conflict data points
Using a spatial join, map the conflict events to the subsetted prio-grid data. Drop the spatial geometry features. (Note: Make sure the coordinate reference systems crs
for the two spatial features match.)
(5) Aggregate the conflict data
Aggregate the conflict data by grid location (gid
). Specifically, you should generate a count of the total number of events that occurred in each grid location from 1997 - 2019. Take the natural log of this count.
Merge the logged event counts back onto the Nigeria grid data using gid
as a key.
(6) Generate a Choropleth Map
Using the Nigeria grid data, make two choropleth maps:
One where the color in each grid corresponds with the total number of events that took place in that grid, and the other capturing nightlight intensity by grid using nlightsMax
. Combine these two plots using patchwork
.
(7) Correlating Development and Instability
Using the Nigeria grid data, generate a scatter plot where the nighttime lights variable is on the x-axis and the total number of events is on the y-axis. Fit a loess curve to the plot. Comment on what you see.
LS0tCnRpdGxlOiAiUFBPTCA2NzAgfCBXZWVrIDcgfCBCcmVha291dCIKc3VidGl0bGU6ICJNYXBwaW5nIENvbmZsaWN0IGluIE5pZ2VyaWEiIApvdXRwdXQ6IAogIGh0bWxfbm90ZWJvb2s6CiAgICBoaWdobGlnaHQ6IGJyZWV6ZWRhcmsKICAgIHRoZW1lOiB1bml0ZWQKICAgIHRvYzogdHJ1ZQogICAgdG9jX2Zsb2F0OiB0cnVlCiAgICB0b2NfZGVwdGg6IDMKLS0tCgpgYGB7cixpbmNsdWRlID0gRn0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KHdhcm5pbmc9RixlcnJvcj1GLG1lc3NhZ2UgPSBGLGVjaG89VCkKYGBgCgo8YnI+PGJyPjxicj4KCiMgT3ZlcnZpZXcKCkxldCdzIHVzZSBzb21lIG9mIHRoZSBza2lsbHMgd2UgcHV0IGludG8gcHJhY3RpY2UgdG8gZXhhbWluZSB0aGUgc3VibmF0aW9uYWwgcmVsYXRpb25zaGlwIGJldHdlZW4gZGV2ZWxvcG1lbnQgYW5kIGNvbmZsaWN0IGluIE5pZ2VyaWEuIAoK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