find_best_split {MigrationDetectR} | R Documentation |
find_best_split
Description
Find the optimal point in time to split a migration interval
Usage
find_best_split(locs, times, movement, from, to)
Arguments
locs |
character, A vector of the locations of occurrences. |
times |
POSIXct, A vector of the occurrences corresponding timestamps. |
movement |
A lubridate interval for which the best split is to be found. |
from |
character, the name of the location the |
to |
character, the name of the location the |
Details
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 atfrom
after the migration date.In cases where multiple days yield the same number of misclassifications, we select the last timestamp as the migration date
Value
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
Author(s)
Johannes Mast Johannes.Mast@dlr.de, based on the algorithm by Guanghua Chi guanghua@berkeley.edu
References
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.