Learn R Programming

# M2B - Movement to behaviour

A package to build behavioural model on track data, using randomForest.

Installation

In a R console:

install.packages("devtools")

library(devtools)

install_github("ldbk/m2b")

Description

Animal behaviour, including social interactions, are fundamental to the field of ecology. Whereas the direct observation of animal behaviour is often limited due to logistical constraints, collection of movement data have been greatly facilitated through the development of bio-logging. Animal movement data obtained through tracking instrumentation may potentially constitute a relevant proxy to infer animal behaviour. This is, however, based on the premise that a range of movement patterns can be linked to specific behaviours.

Statistical learning constitutes a number of methods that can be used to assess the link between given variables from a fully informed training dataset and then predict the values on a non-informed variable. We chose the random forest algorithm for its capacity to deal with imbalanced data (particularly relevant for behavioural data), its high prediction accuracy and its ease of implementation (@breiman2001b, @chen2004). The strength of random forest partly relies in its ability to handle a very large number of variables. Hence, our methodology is based on the derivation of multiple predictor variables from the movement data over various temporal scales, in order to capture as much information as possible on the changes and variations of movement.

In this package we developed a method to link the movement patterns of animals with their behaviour, using the random forest algorithm. The specificity of this method relies on the derivation of multiple predictor variables from the movement data over a range of temporal windows. This procedure allows to capture as much information as possible on the changes and variations of movement and ensures the use of the random forest algorithm to its best capacity. The method is very generic, applicable to any dataset providing movement data together with observation of behaviour.

Copy Link

Version

Install

install.packages('m2b')

Monthly Downloads

306

Version

1.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Laurent Dubroca

Last Published

June 25th, 2025

Functions in m2b (1.1.0)

xytb-class

xytb class definition
xytb

xytb class constructor
dxyt

internal function
shiftvalue

internal function
resB

Representation of the predicted vs observed behaviour of an xytb object
dxyt2

internal function
plot

xytb plot method
ltraj2xytb

ltraj object conversion to xytb object
resRF

Random forest model outputs for a xytb object
m2b

Movement to behaviour package
extractRF

Extract the random forest model from an xytb object
modelRF

xytb randomForest function
test

internal test function for dev purposes
track_CAGA_005

Data collected from a cape gannet track (Morus capensis, Lichtenstein 1823), breeding on Bird Island (Algo Bay, South Africa) in december 2010.
xytb2hmm

xytb object conversion to moveHMM object
xytb2ltraj

xytb class conversion to ltraj object