BoundaryStats was designed to test for the presence of geographic boundaries in ecological variables and overlap between such boundaries. Users can calculate boundary and boundary overlap statistics with raster data. BoundaryStats can create null distributions for the statistics based on various neutral landscape models that are parameterized on the empirical data. The primary functions are statistical tests for the presence of spatial boundaries of a variable and significant overlap between the spatial boundaries of two variables.
You can install BoundaryStats with either:
install.packages('BoundaryStats')
::install_github("aluo734/BoundaryStats") remotes
Function | Category | Description |
---|---|---|
n_subgraph | Boundary | The number of subgraphs, or sets of contiguous boundary elements, in the data. |
max_subgraph | Boundary | The length of the longest subgraph. |
Odirect | Boundary Overlap | The number of directly overlapping boundary elements, or raster cells labelled as part of a boundary, of two traits. |
Ox | Boundary Overlap | The average minimum distance between each boundary element in raster x and the nearest boundary element in raster y. Uses Euclidean distance. The boundaries of trait x depend on the boundaries of trait y. |
Oxy | Boundary Overlap | The average minimum distance between boundary elements in two raster layers. Uses Euclidean distance. Boundaries for each trait affect one another reciprocally (x affects y and y affects x). |
library(BoundaryStats)
library(tidyverse)
data(T.cristatus)
<- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs)
T.cristatus ext(T.cristatus) <- T.cristatus_ext
data(grassland)
<- terra::rast(grassland_matrix, crs = grassland_crs)
grassland ext(grassland) <- grassland_ext
<- categorical_boundary(T.cristatus)
Tcrist_boundaries <- define_boundary(grassland, threshold = 0.1)
grassland_boundaries plot_boundary(Tcrist_boundaries, grassland_boundaries)
<- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = T, n_iterations = 100, x_model = 'random_cluster')
Tcrist_ovlp_null
Odirect(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)
Ox(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)
Oxy(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)
Data source: Cox, Karen; Schepers, Robbert; Van Breusegem, An; Speybroeck, Jeroen (2023), The common ground in landscape effects on gene flow in two newt species in an agroecosystem, Dryad, Dataset, https://doi.org/10.5061/dryad.bk3j9kdhz.