# pmh-tutorial

This code was downloaded from https://github.com/compops/pmh-tutorial and contains the code used to produce the results in the tutorial:

J. Dahlin and T. B. Schรถn, **Getting started with particle Metropolis-Hastings for inference in nonlinear dynamical models**. Journal of Statistical Software, Code Snippets, Volume 88, Number 2, pp. 1-41, Foundation for Open Access Statistics, 2019.

The tutorial is available as open access from Journal of Statistical Software. An R package is also provided on CRAN with the implementation of the tutorial in R. The source code (almost identical to the code in the subdirectory R/) is found at pmh-tutorial-rpkg.

## Included material

**r/** This is the main implementation. The complete R code developed and implemented in the tutorial. This code was used to make all the numerical illustrations in the tutorial including the figures and tables. The workspaces for these runs are also provided as a zip-file in the latest release of the code to reproduce all the figures in the tutorial.

**python/** Code for Python to implement the basic algorithms covered in the tutorial. Implementations for the advanced topics are not provided. Only simple plotting is implemented and no figures or saved data from runs are provided.

**matlab/** Code for MATLAB to implement the basic algorithms covered in the tutorial. Implementations for the advanced topics are not provided. Only simple plotting is implemented and no figures or saved data from runs are provided.

## Generalisations

There is source code available for Python that implements some of the generalisations discussed in the tutorial. See the README file under *python/* for more information.

## Copyright information

See *LICENSE* for more information.

```
##############################################################################
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
##############################################################################
```