knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The sabre (Spatial Association Between REgionalizations) is an R package for calculating a degree of spatial association between regionalizations or categorical maps.
This package offers support for
stars spatial objects, and the following methods:
Two simple regionalizations would be used to show the basic concept of sabre.
library(sabre) library(raster) data("partitions1") data("partitions2")
The first map,
partitions1, has four regions ("r1", "r2", "r3", "r4") of the same size and shape.
The second one,
partitions2, contains three irregular regions where "z1" is the smallest and "z3" being the largest.
Our goal is to compare these two regionalizations and calculate a degree of spatial association between them.
plot(partitions1, main = "partitions1") plot(partitions2, main = "partitions2")
It can be done with
vmeasure_calc(), which calculates "V-measure", "Homogeneity", and "Completeness" and returns two preprocessed input maps.
For raster data, this function requires, at least, two arguments:
starsobject containing the first regionalization
starsobject containing the second regionalization
y must have the same coordinate reference system.
There are also one additional argument -
B > 1 then completeness is weighted more strongly than homogeneity, and if
B < 1 then homogeneity is weighted more strongly than completeness.
By default this value is 1.
partitions_vm = vmeasure_calc(x = partitions1, y = partitions2) partitions_vm
The result is a list with three metrics of spatial association -
Completeness - and two
RasterLayer objects with preprocessed input maps -
All of the above metrics are between 0 and 1, where larger values are desired.
V-measure is a measure of an overall spatial correspondence between input maps.
Homogeneity shows an average homogeneity of the regions in the second map with respect to the regions in the first map.
Completeness is a function of homogeneity of the regions in the first map with respect to the regions in the second map.
The spatial outputs,
$map2, have two layers.
The first one contains regions' names and the second one (
rih) describes regions' inhomogeneities.
plot(partitions_vm$map1[["rih"]], main = "Map1: rih"); plot(partitions_vm$map2[["rih"]], main = "Map2: rih")
For example, "Map1" shows that three regions have the same inhomogeneity of 0.48. This is due a fact that all of these three have two regions from the second map. The upper left region has a larger inhomogeneity of 0.86 as its area "belongs" to three different regions in the second map. More information about this method and its applications can be found in Nowosad and Stepinski (2018).
The sabre also allows for calculating a degree of spatial association between regionalizations using the MapCurve method (Hargrove et al., 2006).
mapcurves_calc() function also requires two arguments,
All of these arguments are explained in the previous section.
partitions_mc = mapcurves_calc(x = partitions1, y = partitions2) partitions_mc
mapcurves_calc() returns a list with a value of the goodness of fit (GOF), the map used as a reference, and two
raster objects with preprocessed input maps -
Read Hargrove et al. (2006) to learn more about this method.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.