A Brief Overview of Hierarchical Bayesian State-Space Models

By Joe Thorley


On a call with a potential client today, I told them that as a company we almost exclusively use Bayesian models. I then added that we usually end up including hierarchical structure through one or more random effects and that, if possible, we like our models to be of the state-space type. Later in an email, they asked for further explanation of what hierarchical Bayesian state-space models are and why we use them - which inspired me to write this short post.


This blog posting should in no-way be considered a complete or 100% technically correct explanation of hierachical Bayesian state-space models but rather an attempt to provide a brief overview.

Bayesian Models

Models can be fitted using a frequentist or Bayesian approach. There are at least three advantages to a Bayesian approach:

There are, however, several downsides to adopting a Bayesian approach.

It also takes much longer to code, validate and describe a Bayesian model than call a pre-existing frequentist model (see Petr Keil for an excellent discussion of the joys and frustrations of being a Bayesian) although I experience this as a creative process that allows me to more fully understand my models, data and estimates and therefore the system under study which is why people pay us in the first place.

Hierachical Models

All statistical models contain at least one stochastic relationship. For example, in the case of a linear regression, the stochastic relationship is the normal distribution that links the predicted values to the observed values. Hierarchical models are those with two or more stochastic relationships. Depending on the model structure the additional stochastic relationships (also known as random effects) can be used to:

However, in order to model a factor as a random effect the factor levels need to be viewable as representative samples of a larger population. Other limitations include the fact that models can take substantially longer to run in the presence of random effects and estimates can be imprecise if there are only data available for a few levels.

Although random effects can be implemented in a frequentist framework, the fact that it is trivial to add them to a Bayesian model is yet another reason why I am a Bayesian.

State-Space Models

Many datasets we analyse consist of fish counts (hence the company name). However our clients aren’t really interested in how many fish the field crew has counted. They want to know how many fish there are in the river and how those numbers are changing through time. So our task as modelers is to use the observed counts to estimate unobserved latent variables such as the actual abundance. In order to do this, we need to explicitly model the underlying ecological or state process, i.e., how many fish there are, and the observational process, i.e., what proportion of the fish are seen. The main advantages of such are approach are:

It should be relatively obvious that such models, which belong to the class of state-space models, are a special type of hierarchical model and therefore like the rest of their brethren naturally fitted within a Bayesian framework.

Further Reading

Hopefully this blog has provided some insight into what hierarchical Bayesian state-space models are and why we use them. If you are interested in further reading I strongly recommend the following two books:

The following journal article which is available online is also worth reading: