Skip to contents

Computes pairwise niche overlap metrics (Schoener's D, Warren's I) between two projected niche rasters. Useful for testing niche conservatism vs. divergence along phylogenetic branches.

Usage

niche_overlap(
  raster1,
  raster2,
  threshold = 0.1,
  method = c("schoener", "warren", "binary")
)

Arguments

raster1

A SpatRaster of suitability values from project_single_niche() or project_ancestral_niche().

raster2

A SpatRaster of suitability values.

threshold

Numeric. Suitability threshold for the binary metric (default 0.1). This is an arbitrary cutoff on the suitability scale, not an estimate of a fundamental-niche boundary.

method

Character. Which metrics to compute: "schoener" (Schoener's D), "warren" (Warren's I), "binary" (binary overlap = proportion of shared suitable area).

Value

A named numeric vector of overlap metrics.

Details

These are raster-based summaries comparing two projected suitability surfaces. The two rasters must share extent, resolution, and CRS.

Schoener's D is computed on the suitability densities normalized to sum 1: D = 1 - 0.5 * sum(|p1(x) - p2(x)|)

Warren's I is the Hellinger-based similarity of the same normalized densities. Both range from 0 (no overlap) to 1 (identical niches). These are descriptive comparisons of projected surfaces, not a formal test of niche conservatism.