Learn R Programming

HMMoce: an R package for improved analysis of marine animal movement data using hidden Markov models

Camrin D. Braun1,2*, Benjamin Galuardi3,4, Simon R. Thorrold2

  1. Massachusetts Institute of Technology-Woods Hole Oceanographic Institution Joint Program in Oceanography/Applied Ocean Science and Engineering, Cambridge, MA 02139
  2. Biology Department, Woods Hole Oceanographic Institution, Woods Hole, MA 02543
  3. School of Marine Science and Technology, University of Massachusetts Dartmouth, Fairhaven, MA 02719
  4. Greater Atlantic Regional Fisheries Office, National Marine Fisheries Service, National Oceanic and Atmospheric Administration, Gloucester, MA 01930

Package Summary

Electronic tagging of marine animals is common throughout the world oceans. Many of these studies have deployed archival tags that rely on light levels and sea-surface temperatures to retrospectively track movements of tagged animals. However, methodological issues associated with light-level geolocation have constrained meaningful inference to species where it is possible to accurately estimate time of sunrise and sunset. Most studies have largely disregarded the oceanographic profiles collected by the tag as a potential way of refining light-level geolocation estimates provided by electronic tags.

Open-source oceanographic measurements and outputs from high-resolution models are increasingly available and accessible. We integrated temperature and depth profiles recorded by electronic tags, with empirical data and model outputs, to construct likelihoods and improve geolocation estimates for marine animals using an existing, but modified, state-space hidden Markov model (HMM). Our model (HMMoce) exhibited as much as 6-fold improvement in pointwise error as compared to traditional light-level geolocation approaches and produced the lowest mean error in 3 of 4 cases when compared to the state-of-the-art tag manufacturer's HMM (GPE3). HMMoce contained behavior state-switching capability not found in other comparable methods. The use of profile-based likelihood estimates proved useful when we removed data to emulate data returned from species that yield poor quality light data. The results demonstrated the general applicability of the HMMoce model to marine animals, particularly those that do not frequent surface waters during crepuscular periods. Our model is available as an open-source R package, HMMoce, that uses a state-space HMM approach and leverages available tag and oceanographic data to improve position estimates derived from electronic tags.

Package Citation

TBD

Package Structure

The package is structured as follows: * Load the relevant tag data and establish a study area of interest. * Get the environmental data to base the likelihood calculations on. * Calculate the desired likelihoods (e.g. depth-temperature profiles, SST, etc) * Estimate parameters and run the model. Results are written out along the way. * Perform model checking and choose a final model.

Installation Instructions

HMMoce can be installed from CRAN from within R using install.packages('HMMoce'). To get the latest developments, get it from GitHub using devtools::install_github('camrinbraun/HMMoce')

Examples

For an example use of the package, please see the vignette using vignette('HMMoce').

Copy Link

Version

Install

install.packages('HMMoce')

Monthly Downloads

2

Version

1.0.0

License

MIT + file LICENSE

Maintainer

Camrin Braun

Last Published

October 29th, 2017

Functions in HMMoce (1.0.0)

calc.param

Calculates movement parameters used for behavior kernels
calc.srss

Calculate Position-based Likelihood from SRSS
calc.woa.par

Calculate WOA profile likelihood in parallel
expmax

Expectation-maximization framework for state-switching
hmm.filter

HMM filter functions
hmm.smoother

Smoother recursion over filtered state estimates
calc.hycom.par

Hycom Profile LIkelihood in Parallel
calc.locs

Calculate Position-based Likelihood
mask.L

Mask L likelihood
meshgrid

Creates grid from matrices
calc.sst.par

Calculate SST-based likelihood in parallel
get.ghr.sst

Download GHR Sea Surface Temperature (SST) data
calc.sst

Calculate SST-based likelihood
likint3

Calculate density function and integrate between limits
liksrss

Calculate density function and integrate between limits
repmat

Repeat your matrix?
resample.grid

Resample likelihood rasters to common resolution/extent
get.hycom

Download HYCOM data
calc.gpe2

Calculate Light Likelihood from GPE2 Output
calc.hycom

Hycom Profile LIkelihood
findDateFormat

Determine date format of vector
gausskern

Create Gaussian Kernel
get.nll.fun

Negative Log likelihood of parameters
get.oi.sst

Download OI Sea Surface Temperature (SST) data
read.wc

Read and format tag data
removePacific

Remove Pacific Ocean data from N. Atlantic analyses
resample.grid.par

Resample likelihood rasters to common resolution/extent
setup.grid

Setup the discrete spatial grid for the HMM
calc.ohc

Calculate Ocean Heat Content (OHC) likelihood surface
HMMoce

HMMoce: an R package for improved analysis of marine animal movement data using hidden Markov models
calc.errEll

Calculates error ellipses around input locations
extract.pdt

Extract PDT from Wildlife Computers tag data
calc.track

Calculate most probable track from state estimates
calc.woa

Calculate WOA profile in parallel
calc.ohc.par

OHC Likelihood in Parallel
get.woa

Download World Ocean Atlas Climatology
getCtr

Get specified contour coordinates
simplifyLocs

Simplifies locations to one per day
make.L

Combine individual source likelihoods
makePar

makePar gets parameters for subsequent filter/smoother
extract.woa

Extract temperatures from World Ocean Atlas
get.bath.data

Download bathymetry data
get.env

Download and Read Oceanographic Data
plotHMM

Plot track results of HMMoce
plotRD

Plot RD results
setup.grid.raster

Setup the discrete spatial grid for the HMM
setup.locs.grid

Setup the discrete spatial grid for the HMM