MyNixOS website logo
Description

Boundary Overlap Statistics.

Analysis workflow for finding geographic boundaries of ecological or landscape traits and comparing the placement of geographic boundaries of two traits. If data are trait values, trait data are transformed to boundary intensities based on approximate first derivatives across latitude and longitude. The package includes functions to create custom null models based on the input data. The boundary statistics are described in: Fortin, Drapeau, and Jacquez (1996) <doi:10.2307/3545584>.

BoundaryStats

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.

DOI

Installation

You can install BoundaryStats with either:

install.packages('BoundaryStats')
remotes::install_github("aluo734/BoundaryStats")

Statistical Tests

Function

Category

Description

n_boundaries

Boundary

The number of subgraphs, or sets of contiguous boundary elements, in the data.

longest_boundary

Boundary

The length of the longest subgraph.

n_overlap_boundaries

Boundary Overlap

The number of directly overlapping boundary elements, or raster cells labeled as part of a boundary, of two traits.

average_min_x_to_y

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.

average_min_distance

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

Example

library(BoundaryStats)
library(tidyverse)

data(ecoregions)
ecoregions <- terra::rast(ecoregions_matrix, crs = ecoregions_crs)
terra::ext(ecoregions) <- ecoregions_ext

data(L.flavomaculatus)
L.flavomaculatus <- terra::rast(L.flavomaculatus_matrix, crs = L.flavomaculatus_crs)
terra::ext(L.flavomaculatus) <- L.flavomaculatus_ext

terra::crs(ecoregions) <- terra::crs(L.flavomaculatus)
ecoregions <- terra::resample(ecoregions, L.flavomaculatus) |>
  terra::crop(L.flavomaculatus) |>
  terra::mask(L.flavomaculatus)
L.flavomaculatus <- terra::crop(L.flavomaculatus, ecoregions) |>
  terra::mask(ecoregions)

L.flavomaculatus_boundary <- define_boundary(L.flavomaculatus, cat = TRUE)
ecoregions_boundary <- define_boundary(ecoregions, cat = T)
plot_boundary(L.flavomaculatus, ecoregions)

Tcrist_ovlp_null <- overlap_null_distrib(L.flavomaculatus, ecoregions, rand_both = FALSE, x_cat = T, n_iterations = 100, x_model = 'random_cluster')

n_overlap_boundaries(L.flavomaculatus, ecoregions, Tcrist_ovlp_null)
average_min_x_to_y(L.flavomaculatus, ecoregions, Tcrist_ovlp_null)
average_min_distance(L.flavomaculatus, ecoregions, 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.

Metadata

Version

2.3.0

License

Unknown

Platforms (76)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows