[Paper Review] An Introduction to Animal Movement Modeling with Hidden Markov Models using Stan for Bayesian Inference
This paper introduces a Bayesian hierarchical hidden Markov model (HMM) for animal movement data using Stan, enabling joint inference of behavioral states and movement parameters. It models positional data as conditionally independent observations given unobserved behavioral states, with state transitions governed by a Markov chain and state-dependent distributions for step length and turning angle, yielding biologically interpretable behavioral states such as foraging and transiting.
Hidden Markov models (HMMs) are popular time series model in many fields including ecology, economics and genetics. HMMs can be defined over discrete or continuous time, though here we only cover the former. In the field of movement ecology in particular, HMMs have become a popular tool for the analysis of movement data because of their ability to connect observed movement data to an underlying latent process, generally interpreted as the animal's unobserved behavior. Further, we model the tendency to persist in a given behavior over time. Notation presented here will generally follow the format of Zucchini et al. (2016) and cover HMMs applied in an unsupervised case to animal movement data, specifically positional data. We provide Stan code to analyze movement data of the wild haggis as presented first in Michelot et al. (2016).
Motivation & Objective
- To develop a flexible, fully Bayesian framework for animal movement modeling using hidden Markov models.
- To enable joint inference of behavioral states and movement parameters via Stan’s MCMC engine.
- To provide a practical implementation using real-world haggis movement data as a case study.
- To validate model adequacy through posterior predictive checks and residual analysis.
- To bridge ecological intuition with statistical modeling by linking latent states to biologically meaningful behaviors.
Proposed method
- Models animal movement as a doubly stochastic process with observed positions conditionally independent given latent behavioral states.
- Uses a time-homogeneous first-order Markov chain to model state transitions via a transition probability matrix Γ.
- Employs state-dependent distributions—gamma for step lengths and von Mises for turning angles—parameterized by behavior-specific means and precisions.
- Applies the forward algorithm to compute the log marginal likelihood efficiently, avoiding numerical underflow in Stan.
- Implements prior distributions: Dirichlet for initial state probabilities, symmetric Dirichlet for transition probabilities, and weakly informative gamma priors for state-specific movement parameters.
- Uses posterior predictive checks and forecast (pseudo-)residuals to assess model fit, including Q-Q plots and ACF comparisons.
Experimental results
Research questions
- RQ1Can a Bayesian HMM in Stan effectively identify distinct behavioral states from animal movement data?
- RQ2How well do the estimated behavioral states align with biologically interpretable movement patterns such as foraging and transiting?
- RQ3To what extent does the model capture temporal dependence in movement data through state persistence?
- RQ4How can posterior predictive checks and residual analysis validate the adequacy of the HMM for movement data?
- RQ5Can the model be extended to include covariates to explain behavioral state transitions?
Key findings
- The HMM successfully identifies two distinct behavioral states in haggis movement data, interpretable as area-restricted search and directed movement.
- Posterior predictive checks show that the model captures the autocorrelation structure of step lengths, with predicted ACFs closely matching observed ACFs within 95% credible intervals.
- Forecast (pseudo-)residuals exhibit approximate normality in Q-Q plots, indicating good model fit for the step length distribution.
- The model efficiently computes the log marginal likelihood using the forward algorithm, enabling stable Bayesian inference in Stan without numerical underflow.
- The estimated transition probability matrix reveals strong persistence in behavioral states, with high self-transition probabilities indicating sustained behavioral bouts.
- The use of weakly informative priors and full Bayesian inference allows for robust uncertainty quantification in both state and parameter estimates.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.