Skip to main content
Log in

Multi-scale Modeling of Animal Movement and General Behavior Data Using Hidden Markov Models with Hierarchical Structures

  • Published:
Journal of Agricultural, Biological and Environmental Statistics Aims and scope Submit manuscript


Hidden Markov models (HMMs) are commonly used to model animal movement data and infer aspects of animal behavior. An HMM assumes that each data point from a time series of observations stems from one of N possible states. The states are loosely connected to behavioral modes that manifest themselves at the temporal resolution at which observations are made. Due to advances in tag technology and tracking with digital video recordings, data can be collected at increasingly fine temporal resolutions. Yet, inferences at time scales cruder than those at which data are collected and, which correspond to larger-scale behavioral processes, are not yet answered via HMMs. We include additional hierarchical structures to the basic HMM framework, incorporating multiple Markov chains at various time scales. The hierarchically structured HMMs allow for behavioral inferences at multiple time scales and can also serve as a means to avoid coarsening data. Our proposed framework is one of the first that models animal behavior simultaneously at multiple time scales, opening new possibilities in the area of animal movement and behavior modeling. We illustrate the application of hierarchically structured HMMs in two real-data examples: (i) vertical movements of harbor porpoises observed in the field, and (ii) garter snake movement data collected as part of an experimental design. Supplementary materials accompanying this paper appear online.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5

Similar content being viewed by others


  • Biuw, M., Boehme, L., Guinet, C., Hindell, M., Costa, D., Charrassin, J.-B., Roquet, F., Bailleul, F., Meredith, M., Thorpe, S., Tremblay, Y., McDonald, B., Park, Y.-H., Rintoul, S.R., Bindoff, N., Goebel, M., Crocker, D., Lovell, P., Nicholson, J., Monks, F. & Fedak, M.A. (2007) Variations in behavior and condition of a Southern Ocean top predator in relation to in situ oceanographic conditions. Proceedings of the National Academy of Sciences, 104, 13705–13710.

    Article  ADS  CAS  Google Scholar 

  • David, M., Dall, S.R.X. & Bshary, R (2016) Unravelling the philosophies underlying ‘animal personality’ studies: A brief re-appraisal of the field. Ethology, 122, 1–9.

    Article  Google Scholar 

  • DeRuiter, S.L., Langrock, R., Skirbutas, T., Goldbogen, J.A., Calambokidis, J., Friedlaender, A.S. & Southall, B.L. (2017) A multivariate mixed hidden Markov model for blue whale behaviour and responses to sound exposure. Annals of Applied Statistics, 11, 362–392.

  • Dingemanse, N.J. & Dochtermann, N.A. (2013) Quantifying individual variation in behaviour: mixed-effect modelling approaches. Journal of Animal Ecology, 82, 39–54.

    Article  PubMed  Google Scholar 

  • Fine, S., Singer, Y. & Tishby N. (1998) The hierarchical hidden Markov model: Analysis and applications. Machine Learning, 32, 41–62.

    Article  MATH  Google Scholar 

  • Hart, T., Mann, R., Coulson, T., Pettorelli, N. & Trathan, P.N. (2010) Behavioural switching in a central place forager: patterns of diving behaviour in the macaroni penguin (Eudyptes chrysolophus). Marine Biology, 157, 1543–1553.

    Article  Google Scholar 

  • Hindell, M., McMahon, C.R., Bester, M.N., Boehme, L., Costa, D., Fedak, M.A., Guinet, C., Herraiz-Borreguero, L., Harcourt, R.G., Huckstadt, L., Kovacs, K.M., Lydersen, C., McIntyre, T., Muelbert, M., Patterson, T.A., Roquet, F., Williams, G. & Charrasin, J.-B. (2016) Circumpolar habitat use in the southern elephant seal: implications for foraging success and population trajectories. Ecosphere, 7, e01213.

    Article  Google Scholar 

  • Japyassú, H.F. & Malange, J. (2014) Plasticity, stereotypy, intra-individual variability and personality: handle with care. Behavioural Processes, 109, 40–47.

    Article  PubMed  Google Scholar 

  • Kleun, E. & Brommer, J.E. (2013) Context-specific repeatability of personality traits in a wild bird: A reaction-norm perspective. Behavioral Ecology, 24, 650–658.

    Article  Google Scholar 

  • Langrock, R., King, R., Matthiopoulos, J., Thomas, L., Fortin, D. & Morales, J.M. (2012) Flexible and practical modeling of animal telemetry data: hidden Markov models and extensions. Ecology, 93, 2336–2342.

    Article  PubMed  Google Scholar 

  • Langrock, R. & Zucchini, W. (2012) Hidden Markov models with arbitrary state dwell-time distributions. Computational Statistics and Data Analysis, 55, 715–724.

    Article  MathSciNet  MATH  Google Scholar 

  • Langrock, R., Marques, T.A., Baird, R.W. & Thomas, L. (2014) Modeling the diving behavior of whales: a latent-variable approach with feedback and semi-Markovian components. Journal of Agricultural, Biological and Environmental Statistics, 19, 82–100.

    Article  MathSciNet  MATH  Google Scholar 

  • Langrock, R., Kneib, T., Sohn, A. & DeRuiter, S.L. (2015) Nonparametric inference in hidden Markov models using P-splines. Biometrics, 71, 520–528.

    Article  MathSciNet  PubMed  MATH  Google Scholar 

  • Leos-Barajas, V., Photopoulou, T., Langrock, R., Patterson, T.A., Murgatroyd, M., Watanabe, Y.Y. & Papastamatiou, Y.P. (2017) Analysis of accelerometer data using hidden Markov models. Methods in Ecology and Evolution, 8(2), 161–173.

  • Li, M. & Bolker, B.M. (2017) Incorporating periodic variability in hidden Markov models for animal movement Movement Ecology, doi:10.1186/s40462-016-0093-6.

    Google Scholar 

  • Luque, S.P. (2007) Diving Behaviour Analysis in R. An Introduction to the diveMove Package. R News, 7, 8–14.

    Google Scholar 

  • Maruotti, A. & Ryden, T. (2009) A semiparametric approach to hidden Markov models under longitudinal observations. Statistics and Computing, 19, 381–393.

    Article  MathSciNet  Google Scholar 

  • Mathot, K.J. & Dingemanse, N.J. (2015) Plasticity and Personality. In Integrative Organismal Biology, pp. 55-69, John Wiley & Sons, NJ, Hoboken.

    Google Scholar 

  • McKellar, A.E., Langrock, R., Walters, J.R. & Kesler, D.C. (2015) Using mixed hidden Markov models to examine behavioural states in a cooperatively breeding bird. Behavioral Ecology, 26, 148–157.

    Article  Google Scholar 

  • Michelot, T., Langrock, R., Bestley, S., Jonsen, I.D., Photopoulou, T. & Patterson, T.A. (2016) Estimation and simulation of foraging trips in land-based marine predators. arXiv:1610.06953.

  • Morales, J.M., Haydon, D.T., Frair, J., Holsinger, K.E. & Fryxell, J.M. (2004) Extracting more out of relocation data: building movement models as mixtures of random walks. Ecology, 85, 2436–2445.

    Article  Google Scholar 

  • Patterson, T.A., Basson, M., Bravington, M.V. & Gunn, J.S. (2009) Classifying movement behaviour in relation to environmental conditions using hidden Markov models. Journal of Animal Ecology, 78, 1113–1123.

    Article  PubMed  Google Scholar 

  • Patterson, T.A., Parton, A., Langrock, R., Blackwell, P.G., Thomas, L. & King, R. (2016), Statistical modelling of animal movement: a myopic review and a discussion of good practice. arXiv:1603.07511.

  • Pohle, J., Langrock, R., van Beest, F.M. & Schmidt, N.M. (2017) Selecting the number of states in hidden Markov models —– pitfalls, practical challenges and pragmatic solutions. arXiv:1701.08673.

  • R Core Team (2016) R: A language and environment for statistical computing, R Foundation for Statistical Computing, Vienna, Austria.

  • Réale, D., Reader, S.M., Sol, D., McDougall, P.T. & Dingemanse, N.J. (2007) Integrating animal temperament within ecology and evolution. Biological Reviews, 82(2), 291–318.

    Article  PubMed  Google Scholar 

  • Roche, D.G., Careau, V. & Binning, S.A. (2016) Demystifying animal ’personality’ (or not): why individual variation matters to experimental biologists. Journal of Experimental Biology, 219, 3832–3843.

    Article  PubMed  Google Scholar 

  • Schliehe-Dieks, S., Kappeler, P.M. & Langrock, R. (2012) On the application of mixed hidden Markov models to multiple behavioural time series. Interface Focus, 2, 180–189.

    Article  Google Scholar 

  • Sih, A., Bell, A. & Johnson, J.C. (2004) Behavioral syndromes: an ecological and evolutionary overview. Trends in Ecology and Evolution, 19(7), 372–378.

    Article  PubMed  Google Scholar 

  • Sih, A., Mathot, K.J., Moirón, M., Montiglio, P.O., Wolf, M. & Dingemanse, N.J. (2015) Animal personality and state-behaviour feedbacks: a review and guide for empiricists. Trends in Ecology and Evolution, 30, 50–60.

    Article  PubMed  Google Scholar 

  • Spiegel, O., Leu, S.T., Bull, C.M. & Sih, A. (2017) What’s your move? Movement as a link between personality and spatial dynamics in animal populations. Ecology Letters, 20, 3–18. doi:10.1111/ele.12708.

  • Stamps, J.A. (2016) Individual differences in behavioural plasticities. Biological Reviews, 91, 534–567.

    Article  PubMed  Google Scholar 

  • Towner, A., Leos-Barajas, V., Langrock, R., Schick, R., Smale, M., Taschke, T., Jewell, O. & Papastamatiou, Y.P. (2016) Sex-specific and individual specialization for hunting strategies in white sharks. Functional Ecology, In press, doi:10.1111/1365-2435.12613.

  • Wisniewska, D. M., M. Johnson, J. Teilmann, L. Rojano-Doñate, J. Shearer, S. Sveegaard, L. A. Miller, U. Siebert & P. T. Madsen (2016) Ultra-high foraging rates of harbor porpoises make them vulnerable to anthropogenic disturbance. Current Biology, 26, 1441–1446.

    Article  CAS  PubMed  Google Scholar 

  • Zucchini, W., MacDonald, I.L. & Langrock, R. (2016) Hidden Markov Models for Time Series: An Introduction using R, 2nd Edition, Chapman & Hall/CRC, FL, Boca Raton.

    MATH  Google Scholar 

Download references


The harbor porpoise movement data were collected as part of the DEPONS project ( funded by the offshore wind developers Vattenfall, Forewind, SMart Wind, ENECO Luchterduinen, East Anglia Offshore Wind and DONG Energy. Funding for snake project provided by Iowa Science Foundation (15-11), the Gaige Award of the American Society of Ichthyologists and Herpetologists, and the National Science Foundation (IOS 0922528 to A.M. Bronikowski). EJG was partially supported by a fellowship from the ISU Office of Biotechnology. JMM received support from grant PICT 2015-0815. VLB thanks Mark S. Kaiser for his support and comments that improved earlier versions of this manuscript.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Vianey Leos-Barajas.

Electronic supplementary material

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Leos-Barajas, V., Gangloff, E.J., Adam, T. et al. Multi-scale Modeling of Animal Movement and General Behavior Data Using Hidden Markov Models with Hierarchical Structures. JABES 22, 232–248 (2017).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: