encounterDistribution: Spatial distribution of encounters

Description Usage Arguments Details Value Warning Note Examples

Description

Computes the expected duration of encounters at each location for every pair of IDs.

Usage

1
2
encounterDistribution(tr, threshold, grid=NULL, timestepSize = 60,
    xc=NULL, yc=NULL, grid.dim = 100, grid.pad = 0.2)

Arguments

tr

The trajectory for which to compute the UD

threshold

The maximum distance at which an encounter occurs

grid

a grid of class asc

timestepSize

The difference between consecutive time steps, in seconds

xc

The x coordinates of the vertical grid lines

yc

The y coordinates of the horizontal grid lines

grid.dim

If all of grid, xc and yc are omitted, this specifies the dimension of the shortest axis of the grid used.

grid.pad

If the grid is automatically generated, its range is the range of the relocations extended grid.pad times the length of the range on each side.

Details

One can specify the grid in three ways:

Value

The return value is a list, indexed by two IDs. If grid is given, each element of the result list is an object of class asc, representing the same grid. Otherwise, each element of the list is a matrix, indexed by the coordinates specified in xc and yc.

Element result[["id1", "id2"]] of the result represents the distribution of the position of id1 while it had encounters with id2. This is not the same as result[["id2","id1"]], since that is the distribution of id2's location during its encounters with id1.

The diagonal entries of the result list contain the utilization distribution of each ID, since an entity is always at a distance 0 from itself.

Warning

There seems to be some problem with the result being transposed, this needs further investigation. Until then, you can plot the transpose of the result using image(t(ud[["BD","NH"]])).

Note

The image function has ugly colours, use the col attribute to define a better colour map.

Also note that this function may take a rather long time to complete, so please be patient, specify a sufficiently small grid or use a larger time step.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data("vervet_monkeys", package="moveBB")

## Define grid lines: equally spaced between the min and max coordinate in monkey.tr
#TODO: define from monkey.tr@extent
xlim <- range(monkey.data$X, na.rm=TRUE)
xc <- seq(xlim[1], xlim[2], length.out=20)

ylim <- range(monkey.data$Y, na.rm=TRUE)
yc <- seq(ylim[1], ylim[2], length.out=20)

## Compute the UD and plot the result for one ID
#ud <- encounterDistribution(monkey.tr, 100, xc=xc, yc=yc)
#image(ud[["BD","NH"]])

moveBB documentation built on May 2, 2019, 5:50 p.m.