Reproducible workflow in R using spdep to compute Bivariate Moran's I for grid-cell data.
Add spatial data to be analysed in folder dataInput.
Input data requirements: It can be raster or csv or shapefile.
If input data is Shapefile with point geometry, you should have values to compare in a single shapefile (e.g., posES and negES).
grid.shp— geometrygrid.dbf— attribute table withNegESandPosEScolumns' valuesgrid.shx— shape indexgrid.prj— coordinate reference system (CRS)- No missing values (or handle them explicitly) (zeros are accepted)
Analytical logic:
The analysis follows three sequential steps of increasing spatial specificity:
- Co-occurrence (OR condition to cells selection) — do NegES and PosES share the same space?
- Pearson correlation (AND condition to cells selection) — within shared space, are values correlated?
- Bivariate Moran's I (AND condition to cells selection) — is that correlation spatially structured?
Summary of steps in script bivariateMoranIndex.Rmd, with indication of code chuncks that need user minimum edits (e.g., file name or tailor options for analyses):
- Input data — EDIT THIS
- Load & reproject
- Choose neighbour method — EDIT THIS
- Co-occurrence summary (OR condition — descriptive)
- Pearson correlation (AND condition)
- Build spatial weights (AND condition)
- Global Bivariate Moran's I
- Local Bivariate Moran's I (LISA)
LISA maps produced will be automatically saved in folder outputs, in 2 formats:
- TIFF (300 dpi, CMYK-compatible) and
- PDF vector format, ideal for resizing without quality loss.