gorithms (NIMBLE Development Team, 2015) to generalize these computational approaches for embedded HMMs. We consider particular combinations of techniques using the flexible and transparent algorithmic control provided by NIMBLE. Although we draw upon capture- recapture for examples, our advances in efficient handling of HMMs can be embedded in any larger hierarchical model structure using NIMBLE. However, we focus attention on the com- putational methodologies rather than implementation details. For comparisons of interest we also include the widely used JAGS package (Plummer, 2003) for MCMC. We begin with a general specification of discrete HMMs, and explain how multistate capture- recapture models may be framed in this context. We then provide the model likelihood, and present a variety of approaches to computing it in the context of MCMC estimation. Let y$_{i}$ = ( y$_{i}$$_{1}$, . . . , y$_{ik}$ ) represent the i th sequence of observations taken over sampling occasions t = 1 , . . . , k . Each y$_{it}$ ∈ Y , where Y is the finite set of possible observations. Similarly, let x$_{i}$ = ( x$_{i}$$_{1}$, . . . , x$_{ik}$ ) be the sequence of true underlying states at occasions t = 1 , . . . , k , with x$_{it}$ ∈ X for finite set of states X . We will consider a total of n observed sequences, hence the full data set is y = ( y$_{1}$, . . . , y$_{n}$ ). Finally, let θ be a vector of all model parameters, which may also include random effects. Letting i take all values in 1 , . . . , n , the general hierarchical model is 5 Θ ∼ p ( θ ) X$_{i}$$_{1}$ ∼ f$_{i}$$_{1}$ ( x$_{i}$$_{1}$ | θ ) X$_{it}$ | X$_{i,t}$$_{−}$$_{1}$ ∼ f$_{it}$ ( x$_{it}$ | θ, x$_{i,t}$$_{−}$$_{1}$ ) , t = 2 , . . . , k Y$_{it}$ | X$_{it}$ ∼ g$_{it}$ ( y$_{it}$ | θ, x$_{it}$ ) , t = 1 , . . . , k (1) 2.1 Discrete HMMs and Multistate Capture-Recapture 2 Computational Approaches to Discrete HMMs