  Traditional Markov chain Monte Carlo (MCMC) sampling of hidden Markov models
(HMMs) involves latent states underlying an imperfect observation process, and
generates posterior samples for top-level parameters concurrently with nuisance
latent variables. When potentially many HMMs are embedded within a hierarchical
model, this can result in prohibitively long MCMC runtimes. We study
combinations of existing methods, which are shown to vastly improve
computational efficiency for these hierarchical models while maintaining the
modeling flexibility provided by embedded HMMs. The methods include discrete
filtering of the HMM likelihood to remove latent states, reduced data
representations, and a novel procedure for dynamic block sampling of posterior
dimensions. The first two methods have been used in isolation in existing
application-specific software, but are not generally available for
incorporation in arbitrary model structures. Using the NIMBLE package for R, we
develop and test combined computational approaches using three examples from
ecological capture-recapture, although our methods are generally applicable to
any embedded discrete HMMs. These combinations provide several orders of
magnitude improvement in MCMC sampling efficiency, defined as the rate of
generating effectively independent posterior samples. In addition to being
computationally significant for this class of hierarchical models, this result
underscores the potential for vast improvements to MCMC sampling efficiency
which can result from combinations of known algorithms.
