Monday, 17 July 2017

Correlation/relationship between map layers in R?


I have a point shapefile concerning asthma instances, a point shapefile concerning rainfall, and a polygon shapefile with population information i.e gender, ages etc.



I would like to research if there is a spatial relationship between the location of asthma and rainfall, and also if there is a spatial relationship between instances of asthma and the population data. Ultimately I would to be able to say:



There are/are not higher instances of asthma in areas that receive more rainfall and/are there are/are not higher instances of asthma in areas with more men/women.



I have done research on the areas of spatial correlation and spatial autocorrelation which I assumed would be related to this area. However, it seems these only correspond to data within one map layer i.e. you cannot technically look for spatial correlation between two map layers.


Is there any way in R to assess correlation/a relationship between two point layers, or a point layer and a polygon layer?



Answer



For your point data on asthma instances and rainfall (as long as it is not interpolated raster data) you can look at the spatial cross-correlation following Chen(2015) & Anselin(1995). Here is a simple example.


Add libraries and data


library(sp)

library(spatialEco)

data(meuse)
coordinates(meuse) <- ~x+y

In the crossCorrelation function, as a starting point I would recommend using the default spatial weights matrix method, by passing plainer coordinates to the coords argument, as it tracks well with the equations presented in Chen(2015).


The default spatial weights matrix (Wij) method is "inverse power" but, there is also a "negative exponent" as an alternative weights function. If you omit the y argument the result is a the univariate local and global autocorealtion. However, if y is also specified, the result represents the cross-correlation, Anselin(1995) defined these statistic(s) as local indicators of spatial association (LISA) in both the univariate and bivariate case(s).


( I <- crossCorrelation(meuse$zinc, meuse$copper, coords = coordinates(meuse), 
clust = TRUE, k=99) )
meuse$lisa <- I$SCI[,"lsci.xy"]

meuse$lisa.clust <- as.factor(I$cluster)
spplot(meuse, "lisa")
spplot(meuse, "lisa.clust")

I would recommend caution when interpreting bivariate cross-correlations (defined as correlation between one variable and the spatial lag of another variable). As, too much emphasis can be put on the spatial relationship, while ignoring the inherent correlation structure of the processes (Lee 2001).


References


Anselin, L. (1995) Local indicators of spatial association. Geographical Analysis. 27:93–115.


Chen., Y. (2015) A New Methodology of Spatial Cross-Correlation Analysis. PLoS One 10(5):e0126158. doi:10.1371/journal.pone.0126158.


Lee, S. (2001) Developing a Bivariate Spatial Association Measure: An Integration of Pearson’s r and Moran’s I. Journal of Geographical Systems 3:369–85.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...