Learn R Programming

bssm (version 1.1.7-1)

particle_smoother: Particle Smoothing

Description

Function particle_smoother performs particle smoothing based on either bootstrap particle filter [1], \(\psi\)-auxiliary particle filter (\(\psi\)-APF) [2], or extended Kalman particle filter [3] (or its iterated version [4]). The smoothing phase is based on the filter-smoother algorithm by [5].

Usage

particle_smoother(model, particles, ...)

# S3 method for gaussian particle_smoother( model, particles, method = "psi", seed = sample(.Machine$integer.max, size = 1), ... )

# S3 method for nongaussian particle_smoother( model, particles, method = "psi", seed = sample(.Machine$integer.max, size = 1), max_iter = 100, conv_tol = 1e-08, ... )

# S3 method for ssm_nlg particle_smoother( model, particles, method = "bsf", seed = sample(.Machine$integer.max, size = 1), max_iter = 100, conv_tol = 1e-08, iekf_iter = 0, ... )

# S3 method for ssm_sde particle_smoother( model, particles, L, seed = sample(.Machine$integer.max, size = 1), ... )

Arguments

model

A model object of class bssm_model.

particles

Number of particles as a positive integer.

...

Ignored.

method

Choice of particle filter algorithm. For Gaussian and non-Gaussian models with linear dynamics, options are "bsf" (bootstrap particle filter, default for non-linear models) and "psi" (\(\psi\)-APF, the default for other models), and for non-linear models option "ekf" (extended Kalman particle filter) is also available.

seed

Seed for RNG (non-negative integer).

max_iter

Maximum number of iterations used in Gaussian approximation, as a positive integer. Default is 100 (although typically only few iterations are needed).

conv_tol

Positive tolerance parameter used in Gaussian approximation. Default is 1e-8.

iekf_iter

Non-negative integer. If zero (default), first approximation for non-linear Gaussian models is obtained from extended Kalman filter. If iekf_iter > 0, iterated extended Kalman filter is used with iekf_iter iterations.

L

Positive integer defining the discretization level for SDE model.

Value

List with samples (alpha) from the smoothing distribution and corresponding weights (weights), as well as smoothed means and covariances (alphahat and Vt) of the states and estimated log-likelihood (logLik).

Details

See one of the vignettes for \(\psi\)-APF in case of nonlinear models.

References

[1] Gordon, NJ, Salmond, DJ, Smith, AFM (1993). Novel approach to nonlinear/non-Gaussian Bayesian state estimation. IEE Proceedings-F, 140, 107-113.

[2] Vihola, M, Helske, J, Franks, J. Importance sampling type estimators based on approximate marginal Markov chain Monte Carlo. Scand J Statist. 2020; 1-38. https://doi.org/10.1111/sjos.12492

[3] Van Der Merwe, R, Doucet, A, De Freitas, N, Wan, EA (2001). The unscented particle filter. In Advances in neural information processing systems, p 584-590.

[4] Jazwinski, A 1970. Stochastic Processes and Filtering Theory. Academic Press.

[5] Kitagawa, G (1996). Monte Carlo filter and smoother for non-Gaussian nonlinear state space models. Journal of Computational and Graphical Statistics, 5, 1-25.

Examples

Run this code
# NOT RUN {
set.seed(1)
x <- cumsum(rnorm(100))
y <- rnorm(100, x)
model <- ssm_ulg(y, Z = 1, T = 1, R = 1, H = 1, P1 = 1)
system.time(out <- particle_smoother(model, particles = 1000))
# same with simulation smoother:
system.time(out2 <- sim_smoother(model, particles = 1000, 
  use_antithetic = TRUE))
ts.plot(out$alphahat, rowMeans(out2), col = 1:2)

# }

Run the code above in your browser using DataLab