# 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?

• Actually, bivariate spatial cross-correlation is straightforward enough but, your specification, using points with polygons, is completely invalid. You are mixing locational and area data, which represent different spatial process. – Jeffrey Evans Apr 11 '18 at 0:44
• This is true, they are different spatial processes. If I were to convert the polygon to points, or even to convert both the point and polygon to raster and use this to assess correlation would this be a mathematically valid approach? I have found this tutorial on using R with raster imagery. The author uses a regular pearson's functions on a set of raster files to compute correlation. statnmap.com/2018-01-27-spatial-correlation-between-rasters But I'm unsure if this is mathematically significiant – Will.S89 Apr 11 '18 at 22:39
• Why would you think that just changing how the feature is represented would change the spatial process? This process is reflective of how the data was measured, not how it is stored as a spatial feature class. If data is aggregated to a census block then it is an aerial process and thus, no longer representing the spatial process at say, a household level. How the spatial relationships are represented are quite different as well with, area data based on Nth-order neighbor contingency and locations on distance or K nearest neighbors. – Jeffrey Evans Apr 11 '18 at 22:48
• Do you mean changing the data's format from polygon to points, or from points to raster? If I changed the polygon to points then both shapefiles would be in the same format. It may be easier to perform analysis such as correlation on the shapefiles if they were in the same format. I am posting this on this website just to see if anyone has any suggestions - I am not an expert so I understand that some of my thought processes might be invalid. I am just trying to understand this. I could not find any academic papers or online information. – Will.S89 Apr 11 '18 at 22:52

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.

``````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.

• this is exactly what I was looking for, thank you very much :) – Will.S89 Apr 12 '18 at 8:55