For my Master thesis, I want to address the question, whether rainfall anomalies can increase the risk of conflicts in Sub-Saharan Africa. As a moderator I have picked climate-related aid programs. The Aid data is a .csv file and comes from http://aiddata.org. The conflict data is a .csv file also and comes from the Social Conflict Analysis Database (https://www.strausscenter.org/scad.html). My precipitation data is from the University of East Anglia (http://wps-web1.ceda.ac.uk/submit/form?proc_id=Subsetter), gridded 0.5° x 0.5° and is a .nc data. I could also download it as a .csv dataset. After loading the data to QGIS it looks like this enter image description here

I would like to combine the data in one dataset and the grid cells as unity of analysis. So I could analyze it with STATA or R. In the journal articles I have read so far, that they always work with grid cells, otherwise they could not combine the point data from conflict datasets to rainfall data. I guess I could use the 0.5° x 0.5° raster of the precipitation data or should I use artificial grid cells. Basically, my question is, how can I combine the data to do regression analysis? I did the QGIS-Tutorial, but did not find any answers to my question. Please help a political science student :). I am happy for any help. Unfortunately, we do not have a geographical faculty at my university.

closed as too broad by Simbamangu, whyzar, xunilk, aldo_tapia, MaryBeth Mar 21 '18 at 19:06

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • yes, R is better for analyzing data, QGIS is awesome for editing maps, but R is great if you have to do a lot of summarizing, filtering, cleaning, plotting graphs and it's more flexible with bad formatted data. – Elio Diaz Mar 21 '18 at 16:31
  • Would you mind to elaborate a little more about your data? Inspecting the figure you posted, I am wondering what the green and brown dots actually represent, and what attribute(s) is stored in each layer. – NewAtGis Mar 21 '18 at 19:26
  • The green dots represent the location of climate-related aid with the AID-id, whereas the brown dots represent conflicts with the conflict-id. – Amelio Tornincasa Mar 22 '18 at 9:43

There are many approaches to achieve what you're trying to do, and you seem to be on the right track; in R you may transform your conflict data into a grid, which keeps the density of conflicts per cell, that's easy with the as.ppp and pixellate functions of library(spatstat), then you may perform a correlation test; other way is to use over function from library(sp) to add the value of each cell to the points that fall on it. Besides reading papers, I suggest you to read the documentation of each package



  • Thank you very much for your reply. So you would suggest me to use R instead of QGIS? – Amelio Tornincasa Mar 22 '18 at 9:42

I would correlate the date of the conflict data with the dated precipitation data and extract the precipitation data of the date of the conflict data so that the conflict data now has some measure of precipitation.

I would also maybe use something like Zonal Statistics as the point represented by the conflict may not be a true representation of the region.

For your curiosity if I were to do it using ArcGIS and Python

I'm not sure how to do this in R / QGIS. However, To get the raster value in ArcGIS / Python as append it to the point:

fc = 'c:/data/conflict.shp'
fields = ['conflict_id', 'SHAPE@XY','precipitation']

# Create update cursor for feature class 
with arcpy.da.UpdateCursor(fc, fields) as cursor:
   for row in cursor:
       result = arcpy.GetCellValue_management("C:/location/percip_raster.tif", row[1][0] row[1][1], "1")
       row[2] = result

By Zonal Statistics

arcpy.Buffer_analysis(fc, "conflict_buffer.shp", "1000 Meters", "FULL", "ROUND", "LIST", "Distance")
outZSaT = ZonalStatisticsAsTable("conflict_buffer.shp", "conflict_id", "C:/location/percip_raster.tif", "out_table.shp", "NODATA", "ALL")

I would not create a grid out of the conflict data as the point location may not directly correlate with overlapping precipitation values.

Not the answer you're looking for? Browse other questions tagged or ask your own question.