Skip to contents

TrajectoryMetrics: steps, headings, turning angles (wrapped to \((-\pi, \pi]\)), straightness (Batschelet 1981) and Benhamou (2004) sinuosity. MeanSquaredDisplacement: time-averaged MSD by lag. FirstPassageTime: Fauchald and Tveraa (2003) FPT with linear interpolation of the circle crossings. SimulateWalk: correlated (wrapped Cauchy), biased and Levy walks from Philox uniforms (streams 0 and 1). OdMatrix: origin-destination counts. Identical to the Python arm morie.fn.movetraj.

Usage

TrajectoryMetrics(track)

MeanSquaredDisplacement(track, max_lag = NULL)

FirstPassageTime(track, times, radius)

SimulateWalk(
  n_steps,
  kind = "correlated",
  step = 1,
  rho = 0.8,
  mu = 2,
  target = c(0, 0),
  bias = 0.5,
  start = c(0, 0),
  seed = 1L
)

OdMatrix(origins, destinations, zones = NULL, weights = NULL)

Arguments

track

Two-column matrix of positions.

max_lag

Maximum lag.

times

Fix times.

radius

Circle radius.

n_steps

Number of steps.

kind

"correlated", "biased" or "levy".

step

Step length (Levy minimum step).

rho

Wrapped Cauchy concentration.

mu

Levy tail exponent.

target

Target of the biased walk.

bias

Weight of the target heading.

start

Starting position.

seed

Philox seed.

origins, destinations

Zone labels of each trip.

zones

Zone order.

weights

Trip weights.

Value

List or vector.

References

Benhamou, S. (2004). How to reliably estimate the tortuosity of an animal's path: straightness, sinuosity, or fractal dimension? Journal of Theoretical Biology 229, 209-220.

Fauchald, P. and Tveraa, T. (2003). Using first-passage time in the analysis of area-restricted search and habitat selection. Ecology 84, 282-288.

Codling, E. A., Plank, M. J. and Benhamou, S. (2008). Random walk models in biology. Journal of the Royal Society Interface 5, 813-834.

Examples

TrajectoryMetrics(rbind(c(0, 0), c(1, 0), c(1, 1), c(2, 1)))$straightness
#> [1] 0.745356
MeanSquaredDisplacement(cbind(0:3, 0))
#> [1] 1 4 9