example2_lgss: Parameter estimation in a linear Gaussian state space model

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/example2-lgss.R

Description

Minimal working example of parameter estimation in a linear Gaussian state space model using the particle Metropolis-Hastings algorithm with a fully-adapted particle filter providing an unbiased estimator of the likelihood. The code estimates the parameter posterior for one parameter using simulated data.

Usage

1
2
example2_lgss(noBurnInIterations = 1000, noIterations = 5000,
  noParticles = 100, initialPhi = 0.5)

Arguments

noBurnInIterations

The number of burn-in iterations in the PMH algorithm. This parameter must be smaller than noIterations.

noIterations

The number of iterations in the PMH algorithm. 100 iterations takes about ten seconds on a laptop to execute. 5000 iterations are used in the reference below.

noParticles

The number of particles to use when estimating the likelihood.

initialPhi

The initial guess of the parameter phi.

Details

The Particle Metropolis-Hastings (PMH) algorithm makes use of a Gaussian random walk as the proposal for the parameter. The PMH algorithm is run using different step lengths in the proposal. This is done to illustrate the difficulty when tuning the proposal and the impact of a too small/large step length.

Value

Returns the estimate of the posterior mean.

Note

See Section 4.2 in the reference for more details.

Author(s)

Johan Dahlin uni@johandahlin.com

References

Dahlin, J. & Schon, T. B. "Getting Started with Particle Metropolis-Hastings for Inference in Nonlinear Dynamical Models." Journal of Statistical Software, Code Snippets, 88(2): 1–41, 2019.

Examples

1
    example2_lgss(noBurnInIterations=200, noIterations=1000)

pmhtutorial documentation built on May 2, 2019, 3:25 a.m.