Learn R Programming

asnipe (version 1.1)

LAR: Mean Lagged Association Rate

Description

Calculate lagged association rate g(tau) from Whitehead (2008)

Usage

LAR(group_by_individual, times, timejump, min_time = NULL, max_time = NULL, identities = NULL, which_identities = NULL, locations = NULL, which_locations = NULL, start_time = NULL, end_time = NULL, classes = NULL, which_classes = NULL)

Arguments

group_by_individual
a K x N matrix of K groups (observations, gathering events, etc.) and N individuals (all individuals that are present in at least one group)
times
K vector of times defining the middle of each group/event
timejump
step length for tau
min_time
minimum/starting value of tau
max_time
maximum/ending value of tau
identities
N vector of identifiers for each individual (column) in the group by individual matrix
which_identities
vector of identities to include in the network (subset of identities)
locations
K vector of locations defining the location of each group/event
which_locations
vector of locations to include in the network (subset of locations)
start_time
element describing the starting time for inclusion in the network (useful for temporal analysis)
end_time
element describing the ending time for inclusion in the network (useful for temporal analysis)
classes
N vector of types or class of each individual (column) in the group by individual matrix (for subsetting)
which_classes
vector of class(es)/type(s) to include in the network (subset of classes)

Value

Returns a matrix with Log(time) in the first column and the lagged association rate in the second

Details

Calculate the lagged association rate for given timesteps.

References

Whitehead (2008) Analyzing Animal Societies section 5.5.1

Examples

Run this code

data("group_by_individual")
data("times")
data("individuals")

## calculate lagged association rate for great tits
lagged_rates <- LAR(gbi,times,3600, classes=inds$SPECIES, which_classes="GRETI")

## plot the results
plot(lagged_rates, type='l', axes=FALSE, xlab="Time (hours)", ylab="LAR", ylim=c(0,1))
axis(2)
axis(1, at=lagged_rates[,1], labels=c(1:nrow(lagged_rates)))

Run the code above in your browser using DataLab