Travel Paths

Bridging the usability gap in open source
animal movement algorithms

Brock, Alison M Ashbury, Rainer Hirk,
Florian Schwendinger, Margaret C Crofoot

whoami

Screenshot of part of a github profile page. Profile photo of an early 20s person with short brown hair, a gold nose ring, wide eyes, and excessive smile against a backdrop that looks like a sea anemone made of blue Nerf gun darts. Below the profile picture in bold: Brock. Below that in lighter typeface: katrinabrock they/them


I help scientists with their data analysis at Max Planck Institute of Animal Behavior.

Hex with travelpaths written in script. Above the word is abstracted flying animals looking a bit like paper airplanes.

travelpaths package provides a consistent interface that simplifies the process of running multiple methods on an animal movement dataset.

Target End User

Researchers who collect movement data using both traditional and automated methods.

Photo of a bonobo hanging from a tree in a thick jungle. It is holding a fruit in its mouth looking at the camera.

Photo of a landscape scene on the savana with mostly grass, some shrubby vegetation, some trees and a river. A man with binoculars in the foreground looking through binoculars at a tree that's the largest in the photo, but still far away. The tree is sparse with leaves and may contain animals, but it's hard to say from the photo.

Close up photo of microcontroler held between a person's fingers. The motherboard is visible and the device is a bit smaller than a single section of one of the person's fingers.

Typically R users with a passion for science not for coding. Much of the analysis is carried out by early career researchers.

Scientific Scope

Animal Movement Data typically consists of x, y, time, and individual id.

Movement Classification is a diverse group of methodologies that break a longer movement path into distinct sections, and optionally group those section.

This step is performed to understand a variety of biologically significant characteristics including but not limited to

  • Key locations
  • Activity state
  • Overall direction of travel

A long thin arrow that's mostly black made up of line segments squiggles accross the image. There are two shaded areas labeled site 1 and site 2. Within each area, the line sements are shorter, closer together, and different colors. However, they are still part of one contininuous arrow.

Six plots stacked virtically. The top one twice as tall as the other five. The top plot has x and y axes and a line that squiggles around at some points looping and crossing back on itself. A graphic in the top left of this plot indicates that it's represents an area in the southwest of Spain. Different parts of the looping line are colored differently. The five lower plots all have time (sec) as a shared x axis, but the y axis is different in each plot. Each of these five plots seems to plot a step function with each step in sync on the time/x axis accross the 5 plots. However, the level of the steps is different for each plot. Each step is a different color and those colors match up to the top plot with the squiggly line.

Gurarie et al. 2017

The Opportunity

Lots of peer-reviewed methods to classify an animal path into segments of interest and group those segments.

The Problem

Takes time to learn how to implement each method. Each user has to dig into each method one by one.

Method 1

flowchart LR
    A1[Look for Code] --> A2[Install from CRAN] --> A3[Reshape Data] --> A4[Run Model] --> A5[Reshape Results] --> A6[Interpret]

Method 2

flowchart LR
    B1[Look for Code] --> B2[Install from Github] --> B3[Determine Data Format] --> B4[Run Model] --> B5[Reshape Results] --> B6[Interpret]

Method 3

flowchart LR
    C1[Look for Code] --> C2[Email Author] -->|Wait| C3[Generalize Code] --> C4[Run Model] --> C5[Reshape Results] --> C6[Interpret]

The Solution

travelpaths contributer integrates each method one time

travelpaths hex

flowchart LR
  A1["Install travelpaths"] --> A2["Reshape data to travelpaths compatible format"] --> A4[Run Method 1] --> A6[Interpret]
  A2 --> B4[Run Method 2] --> B6[Interpret]
  A2 --> C4[Run Method 3] --> C6[Interpret]

Example: CVM, CPT

Two (of many) ways to identify change points in animal movement data

Same image of six plots stacked vertically from earlier slide.

“Correlated Velocity Models” aka CVM Explicitly models speed and direction changes. Can be used to identify change points ie points where the best model changes. Gurarie et al. 2017

Four plots in a 2x2 grid. No axis labels. Each plot a line consistenting of around 100 small segments in a wobbly curcuit shape (not overlapping itself). Five to ten stars on each image mark parts of the circuit that have a sharper angle than other sections.

“Change Point Test” aka CPT Uses permutation test based approach to identify changes in direction. Byrne et al. 2009

Finding code (without travelpaths)

Best Case Scenario (CVM)

  • Direct (working!) link from paper to code

Screenshot of a few paragraphs from an academic paper on springer.com. The words an R package, vignette, and examples are underlined as is the link to github.com/EliGurarie/smoove.

Mid Case Scenario (CPT)

  • Broken link to in paper
  • Author was responsive via email

Screens hot of a word document containing R code.

Reshaping for Input (without trackframe)

CVM

Z location data. Can be: a complex vector, a two-column matrix or data frame, an ltraj object from adehabitatLT or a move object from the move package.

T time vector, ignored if Z is an ltraj or move

Note: move not move2

CPT

[not documented]

two column data.frame of coordinates

Running the Methods (without travelpaths)

CVM

cvm_result <- sweepRACVM(
  Z = my_data[, "utm.easting", "utm.northing"],
  T = my_data$timestamp,
  windowsize = 1000,
  windowstep = 50,
  model = 'UCVM'
) |>
  findCandidateChangePoints(clusterwidth = 4) |>
  getCPtable(modelset = 'UCVM', iterate = TRUE) |>
  estimatePhases()

CPT

Provided as a script, rather than as functions.

Using Output (without trackframe)

CVM

  • Each row represents a segment between change points.
  • start and end indicate the change points in time
  • Extra step to apply back to the input data
  phase               start                 end model      eta          tau      rms
1     I 2015-12-15 23:18:00 2016-01-15 05:36:00  UCVM 434.1731 1.034823e-40 434.1731
2    II 2016-01-15 05:36:00 2016-02-01 01:10:00  UCVM 379.6684 2.438886e-39 379.6684
3   III 2016-02-01 01:10:00 2016-02-26 03:40:00  UCVM 365.9379 7.802973e-29 365.9379
4    IV 2016-02-26 03:40:00 2016-02-28 03:44:00  UCVM 346.7161 8.921303e-36 346.7161
5     V 2016-02-28 03:44:00 2016-04-01 03:12:00  UCVM 399.3652 1.112064e-32 399.3652

CPT

  • Results in a vector of indices of start and end of each segment

    > start
    [1]   6  52 189 222 282 419 440 470 516 692 731 755 876 887 889

Existing Tools

Method authors’ design choices are not inherently bad.

However, inconsistancy among designs results in a system that takes work to navigate.

Running the Methods with travelpaths

Similar to parsnip, user

  • defines the model
  • runs fit(model, data).
library(travelpaths)

data <- move2::movebank_download_study(...)

CVM

cvm_fit <- fit(
  cvm_change_points(method = "zLike"),
  data
)

CPT

cpt_fit <- fit(
  change_point_permtest(),
  data
)

Framework is extensiable.

Logic Written in One Style

Fit functions:

  • support several commonly use input formats
    • sf-based and non-sf-based
    • base R data frame, tibble, data table
  • logic built once
  • return the format the user provided

Enabled by trackframe package.

library(trackframe)

mean_location <- function(data) {
  tf <- as.trackframe(data)
  tf$x_mean <- mean(easting(tf))
  tf$y_mean <- mean(northing(tf))
  return(tf_backtransform(tf))
}

Unified Output Format

CVM

>cvm_fit$fit
A <move2> with `track_id_column` "id" and `time_column` "time"
Containing 1 track lasting 2.73 days in a
Simple feature collection with 1000 features and 3 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: -0.009335803 ymin: -0.002704142 xmax: 0.001792057 ymax: 0.02229348
Projected CRS: WGS 84 / UTM zone 32N
First 10 features:
                  time      id cvm_model                       geometry
1  2025-10-14 15:48:34 track_1         1                    POINT (0 0)
2  2025-10-14 15:49:34 track_1         1 POINT (-4.847714e-05 2.8431...
3  2025-10-14 15:50:34 track_1         1 POINT (0.0005120919 3.69360...
4  2025-10-14 15:51:34 track_1         1 POINT (-0.0002322027 0.0003...
5  2025-10-14 15:52:34 track_1         2 POINT (-0.0003615696 0.0012...
6  2025-10-14 15:53:34 track_1         2 POINT (-0.001313898 0.00116...


CPT

>cpt_fit$fit
A <move2> with `track_id_column` "id" and `time_column` "time"
Containing 1 track lasting 2.73 days in a
Simple feature collection with 1000 features and 3 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: -0.009335803 ymin: -0.002704142 xmax: 0.001792057 ymax: 0.02229348
Projected CRS: WGS 84 / UTM zone 32N
First 10 features:
                  time      id cpt_segment                      geometry
1  2025-10-14 15:48:34 track_1           1                   POINT (0 0)
2  2025-10-14 15:49:34 track_1           1 POINT (-4.847714e-05 2.843...
3  2025-10-14 15:50:34 track_1           2 POINT (0.0005120919 3.6936...
4  2025-10-14 15:51:34 track_1           2 POINT (-0.0002322027 0.000...
5  2025-10-14 15:52:34 track_1           2 POINT (-0.0003615696 0.001...
6  2025-10-14 15:53:34 track_1           2 POINT (-0.001313898 0.0011...

cvm_model, cpt_segment columns identify which segment each data point is part of.

Customizable Plotting Functionality

Based on tinyplot therefore tinyplot themes can be applied.

Project Status

Plan to submit to CRAN by the end of the summer.

Where do we go from here?

  • Extend to more methods
  • Advanced plotting
  • Model comparison functionality

Longer Term: Set the standard for Movement Ecology modeling interface.

Team

Collaboration between Max Planck Institute of Animal Behavior and Quintik Technologies.

Dr. Alison Ashbury

Dr. Rainer Hirk

Dr. Florian Schwendinger

Prof. Dr. Meg Crofoot


Let’s stay in touch

travelpaths hex


linkedin.com/in/brock-2963987a/ 😈 github.com/katrinabrock

Catch me on rOpenSci and Carpentries slack communities