Tools to fit Bayesian state-space models to animal tracking data. Models are provided for location filtering, location filtering and behavioural state estimation, and their hierarchical versions. The models are primarily intended for fitting to ARGOS satellite tracking data but options exist to fit to other tracking data types. For Global Positioning System data, consider the 'moveHMM' package. Simplified Markov Chain Monte Carlo convergence diagnostic plotting is provided but users are encouraged to explore tools available in packages such as 'coda' and 'boa'.
bsam - Bayesian State-space models for Animal Movement.
bsam is an R package that fits Bayesian state-space models via JAGS to Argos satellite tracking data. The models filter error-prone Argos locations and estimate behavioural states associated with two fundamentally different movement patterns (directed, fast movements and relatively undirected, slow movements). The models can be fit to individual animal tracks or simultaneously to a group of individuals. Plotting functions are provided to help assess lack of MCMC convergence, map estimated tracks and visualise fit to the observations.
Read ?bsam for more details on functionality and ?fit_ssm for details and examples of how to use the package.
First ensure that you have a working copy of JAGS (>= 4.2.0) for the rjags package, see instructions below.
library(rjags)Get the released version of bsam from CRAN:
install.packages("bsam")Or download the current development version from GitHub:
# install.packages("devtools") devtools::install_github("ianjonsen/bsam")Install JAGS: http://mcmc-jags.sourceforge.net/
get_summary function to extract summary data_frame from fit_ssm output objects. The data_frame can optionally be written to a .csv filesp and rworldxtra back to Imports list in DESCRIPTION. Ensures all required packages are installed, otherwise map_ssm will return an error when attempting to load countriesHigh data if sp and/or rworldxtra are not installedremoved sp and rworldxtra from Imports
added BugReports URL to DESCRIPTION
Simplified movement models by removing the mean turn angle parameter. This tends to improve convergence for the behavioural switching models
Simplified the regularisation / interpolation in the observation models
Simplified data preparation code
Diagnostic plots (renamed from diagSSM to diag_ssm) now include the Gelman-Rubin-Brooks shrink factor plots for each parameter
New mapping function (map_ssm) uses coastline data from rworldxtra and ggplot2 for core plotting functions
New plot function (plot_fit) to inspect fit to location data
Renamed core function fitSSM to fit_ssm
Improved selection of random initial values for MCMC sampling
Initial values for location states are now based on a loess smooth through the observed locations. Users can control the degree of smoothing via the span argument to fit_ssm
ported from source 2016-05-27 [email protected]il.com
converted to use roxygen2
Added a NEWS.md file to track changes to the package.
f <- "http://web.science.mq.edu.au/~ijonsen/code/bsam_0.43.1.tar.gz"download.file(f, basename(f), mode = "wb")system(sprintf("tar zxvf %s", basename(f)))Rd2roxygen::Rd2roxygen("bsam")