|
1 | 1 | # pmh-tutorial |
2 | 2 |
|
3 | | -This code was downloaded from < https://github.com/compops/pmh-tutorial > or from < http://work.johandahlin.com/ > and contains the code used to produce the results in the tutorial |
| 3 | +This code was downloaded from < https://github.com/compops/pmh-tutorial > and contains the code used to produce the results in the tutorial: |
4 | 4 |
|
5 | 5 | J. Dahlin and T. B. Schön, **Getting started with particle Metropolis-Hastings for inference in nonlinear models**. Pre-print, arXiv:1511:01707, 2017. |
6 | 6 |
|
7 | | -The papers are available as a preprint from < http://arxiv.org/pdf/1511.01707 > and < http://work.johandahlin.com/ >. |
| 7 | +The papers are available as a preprint from < http://arxiv.org/pdf/1511.01707 >. |
8 | 8 |
|
9 | | -Requirements |
| 9 | +Included material |
10 | 10 | -------------- |
11 | | -The code is written and tested for R 3.2.2, Matlab R2014a and Python 2.7.6 with some additional libraries/packages (see below). |
| 11 | +**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 together with the code to reproduce all the figures. |
12 | 12 |
|
13 | | -The implementation in R makes use of the packages Quandl and mvtnorm. They can be installed by the command |
14 | | -``` R |
15 | | -install.packages(c("mvtnorm", "Quandl")) |
16 | | -``` |
17 | | -The implementation in Python makes use of NumPy 1.9.2, SciPy 0.15.1, Matplotlib 1.4.3, Pandas 0.13.1 and Quandl 2.8.9. On Ubuntu, these packages can be installed/upgraded using |
18 | | -``` bash |
19 | | -sudo pip install --upgrade package-name |
20 | | -``` |
21 | | -For more information about the Quandl library, see < https://www.quandl.com/tools/python >. |
| 13 | +**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. |
22 | 14 |
|
23 | | -The implementation in Matlab makes use of the statistics toolbox and the Quandl package. See < https://github.com/quandl/Matlab > for more installation and to download the toolbox. Note that urlread2 is required by the Quandl toolbox and should be installed as detailed in the README file of the Quandl toolbox. |
| 15 | +**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. |
24 | 16 |
|
25 | | -Included files (folders matlab, python and r) |
26 | | --------------- |
27 | | -**example1-lgss.[R,py,m]** Implements the numerical illustration in Section 3.2 of state estimation in a linear Gaussian state space (LGSS) model using the fully-adapted particle filter (faPF). The output is the filtered state estimated as presented in Figure 3. |
28 | | - |
29 | | -**example2-lgss.[R,py,m]** Implements the numerical illustration in Section 3.4 of parameter estimation of the parameter phi in the LGSS model using particle Metropolis-Hastings (PMH) with the faPF as the likelihood estimator. The output is the estimated parameter posterior as presented in Figure 4. |
30 | | - |
31 | | -**example3-sv.[R,py,m]** Implements the numerical illustration in Section 4 of parameter estimation of the three parameters in the stochastic volatility (SV) model using particle Metropolis-Hastings (PMH) with the bootstrap particle filter (bPF) as the likelihood estimator. The output is the estimated parameter posterior as presented in Figure 5. The code takes some time (hours to execute). |
32 | | - |
33 | | -**example4-sv.[R,py,m]** Implements the numerical illustration in Section 5.3.1, which makes use of the same setup as in Section 4.1 but with a tuned proposal distribution. The output is the estimated ACF and IACT as presented in Figure 7. The code takes some time (hours to execute). |
34 | | - |
35 | | -**example5-sv.[R]** Implements the numerical illustration in Section 5.3.2, which makes use of the same setup as in Section 4.1 but with a tuned proposal distribution. The output is the estimated ACF and IACT as presented in Figure 7. The code takes some time (hours to execute). |
36 | | - |
37 | | -**example*.[RData,mat,spdata]** A saved copy of the workspace after running thr corresponding code. Can be used to directly recreate the plots in the tutorial and to conduct additional analysis. |
| 17 | +**r-package/** The files for the R package pmhtutorial on CRAN. These are very similar to the files in *r/*, which is more useful to learn the algorithms covered in the tutorial. However, this R package is simple to download and use directly. |
38 | 18 |
|
39 | | -Supporting files (folders matlab, python and r) |
40 | | --------------- |
41 | | -**stateEstimationHelper.[py,R]** |
42 | | -Implementes the data generation for the LGSS model (generateData), the faPF for the LGSS model (sm), the Kalman filter for the LGSS model (kf) and the bPF for the SV model (sm_sv). In Matlab, these functions are defined in four seperate m-files with the corresponding file names. |
43 | | - |
44 | | -**parameterEstimationHelper.[py,R]** |
45 | | -Implementes the PMH algorithm for the LGSS model (pmh), the SV model (pmh_sv) and the reparameterised SV model (pmh_sv_reparametrised). In Matlab, these functions are defined in two seperate m-files with the corresponding file names. |
46 | | - |
47 | | -Included files (folder r-package) |
48 | | --------------- |
49 | | -The files for the R package pmhtutorial. These should be virtually the same as the files in the folder r but packaged as an R package. The folder r is maintained to keep the code for the three languages as similar as possible. However, the r package is simple to download and use directly. |
50 | | - |
51 | | -Included files (folder matlab-skeleton) |
52 | | --------------- |
53 | | -Skeleton code files for MATLAB to help step-by-step implementation during courses and seminars. |
| 19 | +**matlab-skeleton** Skeleton code files for MATLAB to help step-by-step implementation during courses and seminars. |
54 | 20 |
|
55 | 21 |
|
0 commit comments