difference | R Documentation |

Given a pair of `telemetry`

objects and `ctmm`

movement models, predict their location differences or midpoints at shared times and estimate their distances.

```
difference(data,CTMM,t=NULL,...)
midpoint(data,CTMM,t=NULL,complete=FALSE,...)
distances(data,CTMM,t=NULL,level=0.95,...)
proximity(data,CTMM,t=NULL,GUESS=ctmm(error=TRUE),debias=TRUE,level=0.95,...)
```

`data` |
A |

`CTMM` |
A |

`t` |
An optional vector of times or range of times over which to predict the location differences. |

`complete` |
Additionally calculate timestamps and geographic coordinates. |

`level` |
Confidence level for the distance/proximity estimate. |

`GUESS` |
An optional |

`debias` |
Include inverse- |

`...` |
Options passed to |

The `difference`

function predicts the location difference vectors, `(x_A-x_B,y_A-y_B)`

, for a pair of individuals, `\{A,B\}`

, at overlapping times. The `midpoint`

function predicts the location midpoints, `(x_A+x_B,y_A+y_B)/2`

, for a pair of individuals. The `distances`

function further estimates the instantaneous distances between individuals. The `proximity`

function fits an autocorrelation model to the output of `difference`

, and then compares the mean-square distance between the individuals to what you would expect if the two individuals were moving independently.

`difference`

and `midpoint`

output `telemetry`

objects of the location differences and midpoints with prediction covariances. `distances`

outputs a `data.frame`

of distance estimates with confidence intervals. `proximity`

outputs a ratio estimate with confidence intervals, where values `<1`

indiciate that the two individuals are closer on average than expected for independent movement, `1`

is consistent with independent movement, and values `>1`

indicate that the individuals are farther from each other on average than expected for independent movement. Therefore, if the CIs contain 1, then the distance is insignificant with a p-value threshold of `1-level`

(two-sided) or half that for a one-sided test.

C. H. Fleming.

`ctmm.select`

, `predict.ctmm`

```
#Load package
library(ctmm)
# load buffalo data
data(buffalo)
# select two buffalo that overlap in space and time
DATA <- buffalo[c(1,3)]
# plot the two buffalo
plot(DATA,col=c('red','blue'))
FITS <- list()
for(i in 1:2)
{
GUESS <- ctmm.guess(DATA[[i]],interactive=FALSE)
# in general, you want to use ctmm.select
FITS[[i]] <- ctmm.fit(DATA[[i]],GUESS)
}
# calculate difference vectors
DIFF <- difference(DATA,FITS)
# plot the difference vectors with prediction-error ellipses
plot(DIFF)
# calculate the proximity statistic
# disabling location error for speed
proximity(DATA,FITS,GUESS=ctmm(error=FALSE))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.