Find the optimal point in time to split a migration interval
find_best_split(locs, times, movement, from, to)A tibble of 2 fields:
split_time, a lubridate date time which indicates the time of the optimal split found
split_correctness, a numeric date time which indicates the split's ratio of the wrongly assigned days to the correctly assigned days
character, A vector of the locations of occurrences.
POSIXct, A vector of the occurrences corresponding timestamps.
A lubridate interval for which the best split is to be found.
character, the name of the location the movement ends at. Must match an element in locs.
character, the name of the location the movement ends at. Must match an element in locs.
Johannes Mast Johannes.Mast@dlr.de, based on the algorithm by Guanghua Chi guanghua@berkeley.edu
The function checks which occurrences by locs and times fall within the interval given by movement.
It then tries to find the optimal point in time to split the interval, using the following two criteria:
The point which minimizes the number of misclassified days, i.e., the number of days when the migrant
appears at to before the migration date and days when the migrant appears at
from after the migration date.
In cases where multiple days yield the same number of misclassifications, we select the last timestamp as the migration date
Chi, Guanghua, Fengyang Lin, Guangqing Chi, and Joshua Blumenstock. 2020. “A General Approach to Detecting Migration Events in Digital Trace Data.” Edited by Song Gao. PLOS ONE 15 (10): e0239408. https://doi.org/10.1371/journal.pone.0239408.