Skip to contents

Compares the observed mean squared displacement curve with the envelope and expected curve from simulated trajectories. The discrepancy statistic is the integrated squared error between the observed MSD curve and the mean simulated MSD curve.

Usage

validate_msd(
  observed,
  simulated,
  max_lag = NULL,
  envelope_probs = c(0.025, 0.975),
  ...
)

Arguments

observed

Observed track-like object.

simulated

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

max_lag

Optional maximum lag. If NULL, the largest common lag across observed and simulated tracks is used.

envelope_probs

Numeric vector of length two giving lower and upper envelope quantiles.

...

Passed to as_gmov_simulations().

Value

A list with MSD curves, simulation envelope, discrepancy statistics, 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

observed <- data.frame(x = 0:4, y = 0)
simulated <- list(
  data.frame(x = 0:4, y = 0),
  data.frame(x = 0:4, y = c(0, 0, 1, 1, 1))
)
validate_msd(observed, simulated, max_lag = 2)
#> gmov mean squared displacement diagnostic
#> Maximum lag: 2 
#> Simulated tracks: 2 
#> Statistic: 0.1267 
#> Monte Carlo p-value: 1.000 
#> Alternative: greater