pmh-tutorial-rpkg

R package pmhtutorial available from CRAN.

https://github.com/compops/pmh-tutorial-rpkg

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.9%) to scientific vocabulary

Keywords

cran-r monte-carlo particle-filter particle-metropolis-hastings state-space-model stochastic-volatility-models system-identification tutorial
Last synced: 6 months ago · JSON representation

Repository

R package pmhtutorial available from CRAN.

Basic Info
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Topics
cran-r monte-carlo particle-filter particle-metropolis-hastings state-space-model stochastic-volatility-models system-identification tutorial
Created over 8 years ago · Last pushed almost 7 years ago
Metadata Files
Readme License

README.md

pmh-tutorial-rpkg

This package provides minimal working examples for implementing the particle Metropolis-Hastings (PMH) algorithm for parameter inference in non-linear state space models. The package accompanies the tutorial:

J. Dahlin and T. B. Schön, Getting started with particle Metropolis-Hastings for inference in nonlinear 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 an open access publication from Journal of Statistical Software. Additional standalone code is provided for Python and MATLAB in the GitHub repository pmh-tutorial. This repository also contains R code, which is almost identical to the code provided in the package.

Usage

The main functions of the package are the five examples connected to the tutorial:

  • example1_lgss() State estimation in a LGSS model using the KM and a fully-adapted PF (faPF). The code is discussed in Section 3.1 and the results are presented in Section 3.2 as Figure 4 and Table 1.

  • example2_lgss() Parameter estimation of one parameter in the LGSS model using PMH with the faPF as the likelihood estimator. The code is discussed in Section 4.1 and the results are presented in Section 4.2 as Figure 5.

  • example3_sv() Parameter estimation of three parameters in the SV model using PMH with the bootstrap PF as the likelihood estimator. The code is discussed in Section 5.1 and the results are presented in Section 5.2 as Figure 6. The code takes about an hour to run.

  • example4_sv() Modified version of the code in example3-sv.R to make use of a better tailored parameter proposal. The details are discussed in Section 6.3.2 and the results are presented in the same section as Figures 7 and 8. Note that the only difference in the code is that the variable stepSize is changed.

  • example5_sv() Modified version of the code in example3-sv.R to make use of another parameterisation of the model and a better tailored parameter proposal. The details are discussed in Section 6.3.3 and the results are presented in the same section. Note that the differences in the code is the use of another implementation of PMH ant that the variable stepSize is changed.

Simple example

The examples can be executed by e.g. R example2_lgss() which will recreate on of the plots in the aforementioned tutorial. See the reference for more background and details.

How do I get it?

The package is available through CRAN and can be installed by R install.packages("pmhtutorial") or directly from GitHub by R install.packages("devtools") devtools::install_github("compops/pmh-tutorial-rpkg/package") or downloaded the latest release as a binary package.

Dependencies

The package requires Quandl and mvtnorm to be able to download financial data from the Internet and to generate random variables from the multivariate Gaussian distribution. These can be installed by executing R install.packages(c("Quandl", "mvtnorm")) in the R console if it is not installed at the same time as this package.

How to build the package (notes to the maintainer)

Clone the repo from GitHub. In Rstudio, switch the working directory to package, then run (use devtools::check(run_dont_test=TRUE) to check all the example which takes a looong time) R install.packages(c("devtools", "Quandl", "mvtnorm")) library(devtools) devtools::document() devtools::check(manual=TRUE) devtools::check_win_devel() devtools::check_win_release() devtools::build() An e-mail will be received after 10-20 mins with the result of the rest run on Windows. Also, install and check the package on your local computer. Especially, the LaTeX renderings and similar can be broken. R devtools::install() If everything is fine and all the tests are passed then submit the new release to CRAN by R devtools::check_rhub() devtools::release()

Owner

  • Name: Johan Dahlin
  • Login: compops
  • Kind: user
  • Location: Stockholm, Sweden
  • Company: Kotte Consulting AB

Business-minded PhD passionate about data, algorithms and improving the world

GitHub Events

Total
Last Year

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 33
  • Total Committers: 3
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.333
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Johan Dahlin j****n@n****u 22
Johan Dahlin g****b@j****m 9
Johan Dahlin g****b@k****e 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 7.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • andrewczgithub (1)
Pull Request Authors
Top Labels
Issue Labels
help wanted (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 146 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
cran.r-project.org: pmhtutorial

Minimal Working Examples for Particle Metropolis-Hastings

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 146 Last month
Rankings
Stargazers count: 24.2%
Forks count: 28.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 36.4%
Downloads: 63.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

package/DESCRIPTION cran
  • R >= 3.2.3 depends
  • Quandl * imports
  • grDevices * imports
  • graphics * imports
  • mvtnorm * imports
  • stats * imports