BaBA | R Documentation |
This function classifies animal movement near linear barriers into 6 different behavioral categories: quick cross, average movement, bounce, back-and-forth, trace, and trapped. The classification unit of BaBA first identifies 'encounter events', defined by a series of continuous locations that fall within the barrier buffers. Each event will then be classified into one of the 6 barrier behaviors. Even though many arguments have default settings, we recommend users adjust these values to best fit the ecology and management goals of the studied species.
BaBA(animal, barrier, d,
interval = NULL, b_time = 4, p_time = 36, w = 168, tolerance = 0, units = "hours",
max_cross = 0, sd_multiplier = 1, exclude_buffer = F, round_fixes = F,
export_images = F, img_path = "event_imgs", img_suffix = NULL)
animal |
An |
barrier |
An |
d |
Barrier buffer size in meters if |
interval |
Time interval of the movement data (unit specified in |
b_time |
Maximum duration, in the same unit as |
p_time |
Minimum duration, in the same unit as |
w |
The length of time, in the same unit as |
tolerance |
The maximum duration, in the same unit as |
units |
The temporal units of |
max_cross |
The maximum number of crosses in an encounter event allowed for in tracing and back-and-forth behavior. More see Details. |
sd_multiplier |
A |
exclude_buffer |
|
round_fixes |
|
export_images |
|
img_path |
When |
img_suffix |
|
BaBA
works better with cleaned animal
data. Make sure your date
column is cleaned so that the time difference between any step is evenly divisible by interval
. It is OK to have missing steps but remove repetitive timesteps and bursts of locations smaller than interval
before running BaBA
.
Barrier buffer distance d
represents the distance on both sides of the barrier lines within which animal movement locations are considered 'encounters' with the barrier, and continuous locations form an 'encounter event'. This might be the most important parameter to set the BaBA. The buffer distance will affect numbers and durations of trajectories identified as 'encounter events'. For species with different movement capacities or ecological attributes, barrier effect distance might be different. You can decide the distance either by a priori knowledge or testing a range of distance and compare the results.
The average straightness is compared to the straightness of a to-be-classified encounter event in order to determine whether the event is 'trace' (more straight than average), 'back-n-forth' (less straight than average), or 'normal movement' (similar to average). The reason to apply a moving window method with a width of w
to calculate the average straightness is because some animal movements, such as migrations, show great seasonal variations. The moving window method calculates localized average straightness around the time when the to-be-classified encounter event occurs.
The default average straightness calculation considers movement segments w/2
days before and after the focal encoutner event, which can include movement locations within and outside of the barrier buffers. One might want to control potential impacts of barriers on movement and only calculate average movement straightness based on locatons outside of fence buffers. Use exclude_buffer
to indicate whether or not to include movement locations inside barrier buffers. The default is FALSE
because in the sample study fence density is relatively high and animals fall in barrier buffers much of the time. If excluded, not enough continuous locations within the time window would be outside of the buffer.
The average and standard deviation of straightness measurements calculated by the moving window method are used to define the normal range of movement straightness. Any encounter event with a straightness < (average straightness + sd_multiplier
* sd straightness) would be classified as 'trace' (more straight than normal), < (average straightness - sd_multiplier
* sd straightness) would be 'back-and-forth' (more tortuous than normal), and in between would be 'average movement'. To make the standard more strict for an event to be classified as not 'normal' (i.e. 'back-and-forth' or 'trace'), use a larger number for the sd_multiplier
.
When the barriers are curvy or the temporal resolution of the movement data is coarse, straight lines between movement locations (movement segments) might appear to be crossing the barrier even if the locations are on the same side of the barrier. max_cross
allows some numbers of intersections between movement segments and barriers to be included in the 'trace' and 'back-and-forth' behavior. When the intersections are larger than max_cross
, the encounter event will be classified as 'unknown'.
BaBA
returns a list.
$classification |
a |
$encounters |
a |
Wenjing Xu wenjing.xu@berkeley.edu and Valentine Herrmann HerrmannV@si.edu
Xu W, Dejid N, Herrmann V, Sawyer H, Middleton AD. Barrier Behaviour Analysis (BaBA) reveals extensive effects of fencing on wide-ranging ungulates. J Appl Ecol. https://doi.org/10.1111/1365-2664.13806
library(BaBA)
# load sample data.
data("pronghorn")
data("fences")
# Animal data must be an "sf POINT" object created by the "sf" package.
# individual ID column should be named "Animal.ID" and timestamp column should be named "date"
class(pronghorn)
names(pronghorn)
# run BaBA on the pronghorn data
results_prong <- BaBA(animal = pronghorn, barrier = fences, d = 110, max_cross = 4)
# View BaBA results
head(results_prong$classification)
# plot encounter event locations
plot(fences)
plot(results_prong$encounters, add = TRUE)
# write the encounters as shapefile, changing the date column to character to
# avoid the shapefile dropping the time
sf::st_write(dplyr::mutate(results_prong$encounters, date = as.character(date)),
".", "encountersPRONG", driver = "ESRI Shapefile")
# export event images to visually check event classifications. Using mule deer data as an example
data("muleDeer")
results_deer <- BaBA(animal = muleDeer, barrier = fences, d = 90,
export_images = TRUE, img_suffix = "DEER")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.