encounterDuration: Compute duration of encounters between groups

Description Usage Arguments Details Value See Also Examples

Description

Computes the duration of encounters between each pair of groups over the whole measurement period of a trajectory. The user can select what movement model(s) to apply and whether the result should be on the level of bursts or IDs. encounterDurationById returns the duration of encounters for each pair of IDs, given the duration of encounters for each pair of bursts. This allows to obtain both types of result without recomputing everything.

Usage

1
2
encounterDuration(tr, threshold, model = c("BBMM", "linear"), byburst = FALSE, timestepSize = 60)
encounterDurationById(encounterDurationByBurst)

Arguments

tr

The trajectory to analyze

threshold

The maximum distance at which an encounter is detected

model

The movement models for which to compute the encounter duration

byburst

If TRUE, the result contains durations for pairs of bursts. If FALSE, the result contains encounter durations between pairs of IDs.

timestepSize

If a movement model requires numerical integration in the time dimension, this is the size of each time step.

encounterDurationByBurst

The result of calling encounterDuration with byburst=TRUE.

Details

Since the duration of encounters is a random variable in the Brownian bridge movement model, this function cannot give exact results there. Instead, it reports the expected duration of encounters in the BBMM.

If you already have the encounter duration between bursts and you also want the encounter duration between IDs, you should use encounterDurationById instead of calling encounterDuration again with different parameters. They give identical results, but the former is much faster since it does not recompute all relevant durations.

Value

If byburst == FALSE, the result is a data.frame with one row for each interesting pair of bursts. A pair of bursts is interesting if they overlap in time, since otherwise the duration is always zero. The result contains the following fields:

id1,id2

The IDs of the bursts involved

burst1,burst2

The names of the bursts involved

In addition there is one column for each model requested, named after the model. These columns are of type difftime, with unit secs. They contain the encounter duration according to that model.

If byburst == TRUE, the result is a 3 dimensional array, indexed by the two IDs and the movement model. The entries in the array are again of class difftime with unit secs.

See Also

bbtraj

Examples

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

#ed <- encounterDuration(monkey.tr, 100, byburst=TRUE)
#barplot(ed)

#barplot(encounterDurationById(ed))

# This one has the same result, but needs to recompute everything
#barplot(encounterDuration(monkey.tr, 100))

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