calc_speed_lag: Calculate pairwise speed correlation lag.

Description Usage Arguments Details Value Examples

View source: R/pairwise_correlations.R

Description

Pairwise correlations can be used to determine leader follower relationships. Nagy et al. Nature (464) 2010 used directional correlations, this function allows for speed correlations.

Usage

1
calc_speed_lag(tracks, range = 100, time_bin = NULL)

Arguments

tracks

A tracks object.

range

The range of frames for which lags should be calculated, e.g. 100 means from lags from -100 to +100 are evaluated.

time_bin

Size of time bins in frames (optional). If supplied, for each of these time bins, a seperate lag correlation will be calculated, allowing you to see if the relationships change over the course of the trials.

Details

This function returns two variables per animal pair per trial; lag is the delay where the correlation was maximal (positive means), and cor is the magnitude of the correlation.

Value

A data.frame.

Examples

1
2
3
4
Guppies <- guppies %>%
  as_tracks(30, 1080) %>%
  mutate(speed = speed())
spl <- calc_speed_lag(Guppies)

Ax3man/trackr documentation built on Oct. 8, 2019, 10:53 p.m.