View source: R/find_best_split.R
find_best_split | R Documentation |
Find the optimal point in time to split a migration interval
find_best_split(locs, times, movement, from, to)
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 |
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
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
Johannes Mast Johannes.Mast@dlr.de, based on the algorithm by Guanghua Chi guanghua@berkeley.edu
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.