Learn R Programming

foieGras - fit latent variable movement models to animal tracking data for location quality control and behavioural inference

master branch:

dev branch:

foieGras is an R package that fits a continuous-time model (RW or CRW) in state-space form to filter Argos (or GLS) satellite location data. Template Model Builder (TMB) is used for fast estimation. Argos data can be either (older) Least Squares-based locations, (newer) Kalman Filter-based locations with error ellipse information, or a mixture of the two. The state-space model estimates two sets of location states: 1) corresponding to each observation, which are usually irregularly timed (fitted states); and 2) corresponding to (usually) regular time intervals specified by the user (predicted states). Locations are returned as both LongLat and on the Mercator projection (units=km). Additional models are provided to infer movement behaviour along the SSM-estimated most-probable track.

Installation

First, ensure you have R version >= 3.6.0 installed (preferably R 4.0.0 or higher):

R.Version()

From CRAN

foieGras is on CRAN and can be downloaded within R, in the usual way install.packages("foieGras") or, more completely: install.packages("foieGras", depedencies = c("Imports","LinkingTo","Suggests"))

From GitHub (source)

On PC’s running Windows, ensure you have installed Rtools

On Mac’s, ensure you have installed the Command Line Tools for Xcode by executing xcode-select --install in the terminal; or you can download the latest version from the URL (free developer registration may be required). A full Xcode install uses up a lot of disk space and is not required.

To get the very latest foieGras stable version, you can install from GitHub:

remotes::install_github("ianjonsen/foieGras")

Note: there can be issues getting compilers to work properly, especially on a Mac with OS X 10.13.x or higher. If you encounter install and compile issues, I recommend you consult the excellent information on the glmmTMB GitHub.

Basic example

foieGras is intended to be as easy to use as possible. Here’s an example showing how to quality-control Argos tracking data, and infer a behavioural index along the estimated animal tracks:

library(tidyverse)
library(foieGras)

fit <- fit_ssm(sese, vmax= 4, model = "crw", time.step = 24, control = ssm_control(verbose = 0, se = FALSE))

fmp <- fit_mpm(fit, what = "predicted", model = "jmpm", control = mpm_control(verbose = 0))

plot(fmp, pages = 1, ncol = 3, pal = "Zissou1", rev = TRUE)


fmap(fit, fmp, what = "predicted", pal = "Cividis")

What to do if you encounter a problem

If you are convinced you have encountered a bug or unexpected/inconsistent behaviour when using foieGras, you can post an issue here. First, have a read through the posted issues to see if others have encountered the same problem and whether a solution has been offered. You can reply to an existing issue if you have the same problem and have more details to share or you can submit a new issue. To submit an issue, you will need to clearly describe the unexpected behaviour, include a reproducible example with a small dataset, clearly describe what you expected to happen (but didn’t), and (ideally) post a few screenshots/images that nicely illustrate the problem.

How to Contribute

Contributions from anyone in the Movement Ecology/Bio-Logging communities are welcome. Consider submitting a feature request here to start a discussion. Alternatively, if your idea is well-developed then you can submit a pull request for evaluation here. Unsure about what all this means but still want to discuss your idea? then have a look through the GitHub pages of community-built R packages like tidyverse/dplyr for examples.

Code of Conduct

Please note that the foieGras project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('foieGras')

Monthly Downloads

76

Version

0.7-6

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Ian Jonsen

Last Published

April 26th, 2021

Functions in foieGras (0.7-6)

fit_mpm

fit a a Move Persistence Model (mpm)
plot.fG_ssm

plot
plot.fG_simfit

plot
fit_ssm

Fit a continuous-time state-space model to filter Argos satellite geolocation data
mpm_control

Control Values for fit_mpm.
grab

grab tibble's by name from a foieGras model object
osar

calculate one-step-ahead (prediction) residuals from a foieGras fit
sese

Southern elephant seal Argos satellite data (5 individuals)
join

join an mpm-estimated behavioural index to ssm-predicted locations
plot.fG_osar

plot
elps

generate error ellipses from x,y coordinates, semi-major, semi-minor axes and ellipse orientation
emf

emf
sese2

Southern elephant seal Argos satellite data (2 highly sub-sampled individuals)
ssm_control

Control Values for fit_ssm.
plot.fG_mpm

plot
wrap_lon

wrap_lon
sfilter

fit the state-space model to data after passing through prefilter
sim

simulate animal tracks
plot.fG_sim

plot
simfit

simulate animal tracks from a fG_ssm fit
mpmf

fit the move persistence model to regularized location data
sese1

Southern elephant seal Argos satellite data (1 individual)
res

foieGras example osar residuals object
rtnorm

rtnorm
print.ssm

print foieGras fit object summary information
prefilter

Prepare Argos data for fitting state-space model
xm

foieGras example mpm fit object
foieGras-package

foieGras
fmap

fmap
ellie

Southern elephant seal Argos satellite data (1 individual, sub-sampled for testing speed)
ellp.par

simulate Argos ellipse params & sample errors from multivariate normal
argos_lc

simulate Argos error classes for LS data
dummy

Roxygen commands