# indmove: Testing Independence in Regular Trajectory Parameters In adehabitat: Analysis of Habitat Selection by Animals

## Description

The function `indmove` tests for the independence between successive components `c(dx, dy)` for each burst in a regular object of class `ltraj`.

The function `indmove.detail` tests for the independence between successive `dx` or `dy` for each burst in a regular object of class `ltraj`.

The function `testang.ltraj` tests for the independence between successive angles (relative or absolute) for each burst in a regular object of class `ltraj`.

The function `testdist.ltraj` tests for the independence between successive distances between successive relocations for each burst in a regular object of class `ltraj`.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```indmove(ltr, nrep = 200, conflim = seq(0.95, 0.5, length=5), sep = ltr[[1]]\$dt[1], units = c("seconds", "minutes", "hours", "days"), plotit = TRUE) testang.ltraj(x, which = c("absolute", "relative"), nrep = 999, alter = c("two-sided","less","greater")) testdist.ltraj(x, nrep = 999, alter = c("two-sided","less","greater")) indmove.detail(x, detail=c("dx","dy"), nrep=999, alter = c("two-sided","less","greater")) ```

## Arguments

 `ltr,x` an object of class `ltraj` `conflim` a vector giving the limits of the confidence intervals to be plotted `nrep` number of simulations `units` a character string indicating the time units for the result `alter` a character string specifying the alternative hypothesis, must be one of "greater", "less" or "two-sided" (default) `which` a character string indicating whether the absolute or relative angles are under focus `detail` a character string indicating whether `"dx"` or `"dy"` should be tested for independence `plotit` logical. Whether the results should be plotted on a graph `sep` used in the case of variable time lag between relocations. Indicates the theoretical time lag between two relocations

## Details

The function `indmove` randomises the order of the increments `c(dx, dy)` in a trajectory. The criteria of the test is the Mean Squared Displacement (`R^2_n`) (Root & Kareiva 1984).

The function `testang.ltraj` randomises the order of the angles in a trajectory. The criteria of the test is ```f^2 = sum_(i=1)^(n-1) 2*(1 - cos(angle[i+1] - angle[i]))```. This measure corresponds to the mean squared length of the segment joining two successive angles on the trigonometric circle (see examples for an illustration)

The function `testdist.ltraj` randomises the order of the distances between successive relocations in a trajectory. The criteria of the test is ```sum_(i=1)^(n-1) (dist[i+1] - dist[i])^2 ``` (Neuman 1941, Neuman et al. 1941). The same criteria is used in `indmove.detail()`.
.

Note that these functions require "regular" trajectories, i.e. trajectories for which the relocations are separated by a constant time lag.

Finally, note that the functions `testang.ltraj` and `testdist.ltraj` are not affected by the presence of missing values in the bursts of relocations. The function `indmove` may be greatly affected by these missing values (they are removed prior to the test).

## Value

`indmove()` returns a list with one component per burst. Each component is a list of two data frames. The data frame `Time` contains the time points at which R2n is computed for the observation (first column) and the simulations (other ones). The data frame `R2n` contains the values for the R2n (same dimensions).

`testang.ltraj()`, `testdist.ltraj` and `indmove.detail` return lists of objects of class `randtest`.

## Author(s)

Clement Calenge [email protected]
Stephane Dray [email protected]

## References

Root, R.B. & Kareiva, P.M. (1984) The search for resources by cabbage butterflies (Pieris Rapae): Ecological consequences and adaptive significance of markovian movements in a patchy environment. Ecology, 65: 147–165.

Neumann, J.V., Kent, R.H., Bellinson, H.R. & Hart, B.I. (1941) The mean square successive difference. Annals of Mathematical Statistics, 12: 153–162

Neumann, J.V. (1941) Distribution of the ration of the mean square successive difference to the variance. The Annals of Mathematical Statistics, 12: 367–395

`ltraj`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38``` ```## Not run: ## theoretical independence between br <- simm.brown(1:1000) testang.ltraj(br) testdist.ltraj(br) indmove(br) ## End(Not run) ## Illustration of the statistic used for the test of the independence ## of the angles opar <- par(mar = c(0,0,4,0)) plot(0,0, asp=1, xlim=c(-1, 1), ylim=c(-1, 1), ty="n", axes=FALSE, main="Criteria f for the measure of independence between successive angles at time i-1 and i") box() symbols(0,0,circle=1, inches=FALSE, lwd=2, add=TRUE) abline(h=0, v=0) x <- c( cos(pi/3), cos(pi/2 + pi/4)) y <- c( sin(pi/3), sin(pi/2 + pi/4)) arrows(c(0,0), c(0,0), x, y) lines(x,y, lwd=2, col="red") text(0, 0.9, expression(f^2 == 2*sum((1 - cos(alpha[i]-alpha[i-1])), i==1, n-1)), col="red") foo <- function(t, alpha) { xa <- sapply(seq(0, alpha, length=20), function(x) t*cos(x)) ya <- sapply(seq(0, alpha, length=20), function(x) t*sin(x)) lines(xa, ya) } foo(0.3, pi/3) foo(0.1, pi/2 + pi/4) foo(0.11, pi/2 + pi/4) text(0.34,0.18,expression(alpha[i]), cex=1.5) text(0.15,0.11,expression(alpha[i-1]), cex=1.5) par(opar) ```