How-To Guides
Each guide shows how to turn a model's equations into working MATLAB code with the core functions of statespace-toolkit, one step at a time, on a small example with generated data. A script with each guide reproduces every number and figure on its page. The guides come in series, and within a series each guide builds on the one before. These pages summarize the guides; the full guides on GitHub give the derivations, the code and the checks. The tutorials answer empirical questions with the models of published papers.
Getting Started with the Precision Sampler
The three guides use the local level model on the same generated data.
- How to Draw the States of an Unobserved Components Model
Stack the equations of the model, read the precision matrix of the states off the log density, and draw the whole path of the states at once. - How to Estimate a State Space Model by Gibbs Sampling
Draw the parameters and the states in turn, and check the chain. - How to Compute the Integrated Likelihood of a State Space Model
Integrate the states out of the likelihood, and draw the parameters without them.
By Chapter of the Book
The guides follow the notation of Bayesian Macroeconometrics (Chan, forthcoming), and each names the sections of the book behind its method:
- Chapter 6, Foundations of Bayesian Computation
- How to Estimate a State Space Model by Gibbs Sampling (Sections 6.3 and 6.5.2)
- How to Compute the Integrated Likelihood of a State Space Model (Sections 6.2.2 and 6.3.2)
- Chapter 9, Linear Gaussian State Space Models
- How to Draw the States of an Unobserved Components Model (Sections 9.1.1 and 9.2)
- How to Estimate a State Space Model by Gibbs Sampling (Section 9.1.1)
- How to Compute the Integrated Likelihood of a State Space Model (Section 9.2)