{ "cells": [ { "cell_type": "markdown", "id": "cb5f4d23", "metadata": {}, "source": [ "# Animal movement: a continuum the HMM cannot represent\n", "\n", "Animal behaviour is commonly inferred from a GPS track using a Hidden Markov Model, as implemented in the `moveHMM` and `momentuHMM` packages. Each step is assigned to one of K discrete behavioural states — classically two, *encamped/foraging* and *exploratory/transit* — each with its own step-length distribution and a matrix of state-to-state transition probabilities. This approach has two limitations. First, the number of states K must be fixed in advance, and selecting it is difficult, as common criteria such as AIC and BIC often disagree. Second, behaviour is sorted into discrete categories, so variation within a state and gradual transitions between states are not represented.\n", "\n", "Here we take a different approach with *bayesloop* and treat the movement scale itself as a continuous, time-varying parameter. It is inferred together with its uncertainty, and the model evidence is used to decide whether the dynamics are static, gradually drifting, or abruptly switching, without fixing a number of states in advance. We model the 6-hourly step length as Rayleigh-distributed (the exact law of the distance moved under 2-D isotropic Gaussian increments, and rotation-invariant, so directional persistence does not bias it) with a time-varying scale $D_t$. In the course of the analysis we use a custom `bl.om.NumPy` observation model, a `HyperStudy` over the smoothness of the drift, and `RegimeSwitch`, and we select the kind of dynamics based on the evidence. We then benchmark the result against a 2-state Gaussian HMM fitted with `hmmlearn`.\n", "\n", "