The goal of bespatial is to calculate several entropy metrics for spatial data inspired by Boltzmann’s entropy formula. It includes metrics introduced by Cushman for landscape mosaics (Cushman (2015)), landscape gradients and point patterns (Cushman (2021)); by Zhao and Zhang for landscape mosaics (2019); and by Gao et al. for landscape gradients (2017, 2019).
You can install the released version of bespatial from CRAN with:
install.packages("bespatial")
You can install the development version from GitHub with:
install.packages("bespatial", repos = "https://nowosad.r-universe.dev")
Let’s start by attaching relevant packages and reading example data mosaic
. This dataset contains 12 raster layers, where each has an equal number of cells with values 1 and 2 (identical compositions), but they are differently arranged in space (different configurations).
library(terra)
library(bespatial)
mosaic = rast(system.file("raster/mosaic.tif", package = "bespatial"))
Now, we can calculate a selected metric, for example, Cushman’s configurational entropy for landscape mosaics with bes_m_cushman()
:
ce1 = bes_m_cushman(mosaic, nr_of_permutations = 1000)
plot(mosaic, main = round(ce1$value, 2))
The above results show that the less random the configuration is, the smaller Cushman’s configurational entropy value is.
Each function in this package has a similar name:
bes_
m_
for mosaics (categorical rasters), g_
for gradients (g_
) (continuous rasters), or p_
for point patterns (rasters with one value and NAs)cushman
, zhao
, or gao
Function | Description |
---|---|
bes_m_cushman() |
Cushman’s configurational entropy for landscape mosaics (2015) |
bes_m_zhao() |
Zhao’s configurational entropy for landscape mosaics based on the Wasserstein metric (2019) |
bes_g_cushman() |
Cushman’s configurational entropy for surfaces (2021) |
bes_g_gao() |
Boltzmann entropy of a landscape gradient by Gao (2017, 2019) |
bes_p_cushman() |
Cushman’s configurational entropy for point patterns (2021) |
Contributions to this package are welcome - let us know if you have any suggestions or spotted a bug. The preferred method of contribution is through a GitHub pull request. Feel also free to contact us by creating an issue.