DLM Matlab Toolbox

Dynamic Linear Model Matlab toolbox

This is a collection of Matlab files for Dynamic Linear Model calculations suitable for time series analysis. The code supplements the article M. Laine, N. Latva-Pukkila and E. Kyrölä: Analyzing time-varying trends in stratospheric ozone time series using state the space approach, in Atmospheric Chemistry and Physics 14(18), 2014, doi: 10.5194/acp-14-9707-2014.

The code is provided as auxiliary material for the paper and might be useful to you if you are already familiar with Matlab and MCMC and state space analysis of time series. Some references are given at the end.

The toolbox provides tools to estimate dynamic linear state space mode suitable for analysing univariate and multivariate time series. It uses Kalman filter, smoother and simulation smoother to estimate the states and Markov chain Monte Carlo (MCMC) to sample from the model error variance parameter posterior distribution.

See DLM tutorial for some info on using this DLM toolbox for time series analysis.

Downloads

The full Matlab code and this documentation are available from GitHub. To install the toolbox clone the folder dlm to a suitable directory and then add Matlab path to that directory.

git clone https://github.com/mjlaine/dlm.git

Alternatively, you can download the whole repository as a zip file from the GitHub page or directly as https://github.com/mjlaine/dlm/archive/master.zip

In addition to the code provided below, you will need my Matlab MCMC Toolbox (direct Github link). MCMC is used to infer and sample the variance parameters needed in defining the linear state space model.

The code is distributed under a MIT License and comes with no warranty. The documentation is minimal at the moment. Please read the source code for details of the algorithms used. Question and suggestions are welcome. If you find the code useful, it would be kind to acknowledge me in your research articles.

Examples

Some examples as Matlab demos.

Nile river flow
Classical Nile river data, file niledemo.m.
DLM demo 1
Fits Kalman smoother and does Gibbs sampling on variance parameters.
DLM demo 2
Fits synthetic time series with ML optimization.
DLM demo 3
Fits synthetic multivariate time series.
Ozone time series
Reproduces the fit used in the Ozone time series article.

See also example in the the DLM tutorial.

References

Laine, M., Latva-Pukkila, N., Kyrölä, E., Analyzing time-varying trends in stratospheric ozone time series using the state space approach, Atmospheric Chemistry and Physics, 14(18), pages 9707–9725, 2014. doi: 10.5194/acp-14-9707-2014.

Durbin, T. and Koopman, S.,/Time Series Analysis by State Space Methods/, Oxford University Press, second edn, 2012. Google books link.

Petris, G., Petrone, S., and Campagnoli, P., Dynamic Linear Models with R, Use R!, Springer, 2009. Google books link.


Author: Marko Laine

Created: 2018-11-20 Ti 17:11