View source: R/get_associations_points_tw.R
get_associations_points_tw | R Documentation |
A time window approach to calculate group co-memberships.
get_associations_points_tw(point_data, time_window = 180, which_days = NULL,
which_locations = NULL)
point_data |
dataframe of four columns: |
time_window |
window around each individual for calculating associations |
which_days |
subset of |
which_locations |
subset of |
Calculates an ego-centric approach to group membership (see warning). For each detection, a group is created with and all associates within the time window at the same location are included.
Input data must be of the following form: Date is an integer for day (usually starting at 1 on the first day). Time are the number of seconds elapsed from the start (continuous across all dates). ID is a unique character string for each individual. Location is a unique character string for each location.
Returns a list with three objects: 1. group by individual matrix (K rows by N columns) 2. an vector of times for each group 3. a vector of dates for each group 4. a vector of locations for each group
This method biases associations of dyads occuring in large groups because it creates one row in the association matrix for each detection of an individual. For this reason, this function should not be used (see also Psorakis et al. 2015 Behavioural Ecology & Sociobiology). One way to circumvent this is by including only groups centered around the focal individual when calculating associations. However, none of the functions in this package are implement this way.
Damien R. Farine
data("identified_individuals")
## calculate group_by_individual for first day at one location
group_by_individual <- get_associations_points_tw(identified_individuals, time_window=180,
which_days=1,which_locations="1B")
## split the resulting list
times <- group_by_individual[[2]]
dates <- group_by_individual[[3]]
locations <- group_by_individual[[4]]
group_by_individual <- group_by_individual[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.