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
SpatRasterof suitability values fromproject_single_niche()orproject_ancestral_niche().- raster2
A
SpatRasterof 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).
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.