Skip to contents

Counts movement segments that intersect a known linear barrier. This is a segment-intersection diagnostic for barrier interaction: a segment that touches, overlaps, or crosses the barrier is counted once, even if it intersects multiple barrier features. This diagnostic is intended for settings where a barrier is specified before validation. It does not discover unknown barriers and does not classify the ecological mechanism of an interaction.

Usage

validate_barrier_crossing(
  observed,
  simulated,
  barrier,
  alternative = c("less", "greater", "two.sided"),
  ...
)

Arguments

observed

Observed track-like object.

simulated

A list of simulated track-like objects or a data frame with a simulation identifier column.

barrier

An sf or sfc object containing LINESTRING or MULTILINESTRING geometries. The barrier and track coordinates are assumed to use the same planar coordinate system.

alternative

Character passed to mc_rank_test(). The default "less" tests whether observed crossings are unusually few relative to simulations, as in an over-permeable fitted model.

...

Passed to as_gmov_simulations().

Value

A list with observed and simulated segment-intersection counts and a Monte Carlo rank test.

References

Nicosia, A. (2026). Beyond the next step: A multi-criteria generative validation framework for step selection functions. Methods in Ecology and Evolution. https://doi.org/10.1111/2041-210x.70313

Examples

barrier <- sf::st_sfc(
  sf::st_linestring(matrix(c(0.5, -1, 0.5, 1), ncol = 2, byrow = TRUE)),
  crs = 3857
)
observed <- data.frame(x = c(0, 0.25, 0.4), y = c(0, 0, 0))
simulated <- list(
  data.frame(x = c(0, 1), y = c(0, 0)),
  data.frame(x = c(0, 0.75), y = c(0.2, 0.2))
)
validate_barrier_crossing(observed, simulated, barrier)
#> gmov barrier interaction diagnostic
#> Method: segment_intersection_count 
#> Simulated tracks: 2 
#> Observed count: 0 
#> Monte Carlo p-value: 0.333 
#> Alternative: less