diff --git a/DESCRIPTION b/DESCRIPTION index e3db94ad..d4b55d44 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: bssm Type: Package Title: Bayesian Inference of State Space Models -Version: 0.0.74 -Date: 2017-02-24 +Version: 0.0.75 +Date: 2017-05-10 Author: Jouni Helske, Matti Vihola Maintainer: Jouni Helske Description: Efficient methods for Bayesian inference of state space models. diff --git a/R/particle_smoother.R b/R/particle_smoother.R index 856ed031..077e5af1 100644 --- a/R/particle_smoother.R +++ b/R/particle_smoother.R @@ -5,7 +5,7 @@ #' #' @param object Model. #' @param nsim Number of samples. -#' @param filter Choice of particle filter algorithm. For Gaussian models, +#' @param filter_type Choice of particle filter algorithm. For Gaussian models, #' possible choices are \code{"bsf"} (bootstrap particle filter) and #' \code{"apf"} (auxiliary particle filter). In addition, for non-Gaussian or #' non-linear models, \code{"psi"} uses psi-particle filter, and @@ -160,7 +160,7 @@ particle_smoother.svm <- function(object, nsim, out$alpha <- aperm(out$alpha, c(2, 1, 3)) out } - +#' @rdname particle_smoother #' @method particle_smoother nlg_ssm #' @export particle_smoother.nlg_ssm <- function(object, nsim, diff --git a/R/run_mcmc.R b/R/run_mcmc.R index c2972c6f..dbb78435 100644 --- a/R/run_mcmc.R +++ b/R/run_mcmc.R @@ -216,7 +216,7 @@ run_mcmc.ngssm <- function(object, n_iter, nsim_states, type = "full", delayed_acceptance = TRUE, n_burnin = floor(n_iter/2), n_thin = 1, gamma = 2/3, target_acceptance = 0.234, S, end_adaptive_phase = TRUE, local_approx = TRUE, n_threads = 1, - seed = sample(.Machine$integer.max, size = 1), ...) { + seed = sample(.Machine$integer.max, size = 1), max_iter = 100, conv_tol = 1e-8, ...) { a <- proc.time() check_target(target_acceptance) @@ -474,7 +474,7 @@ run_mcmc.nlg_ssm <- function(object, n_iter, nsim_states, type = "full", delayed_acceptance = TRUE, n_burnin = floor(n_iter/2), n_thin = 1, gamma = 2/3, target_acceptance = 0.234, S, end_adaptive_phase = TRUE, n_threads = 1, seed = sample(.Machine$integer.max, size = 1), max_iter = 100, - conv_tol = 1e-8, iekf_iter = 0, ...) { + conv_tol = 1e-4, iekf_iter = 0, ...) { a <- proc.time() check_target(target_acceptance) diff --git a/man/particle_smoother.Rd b/man/particle_smoother.Rd index dd3399d7..99525805 100644 --- a/man/particle_smoother.Rd +++ b/man/particle_smoother.Rd @@ -4,6 +4,7 @@ \alias{particle_smoother} \alias{particle_smoother.gssm} \alias{particle_smoother.ngssm} +\alias{particle_smoother.nlg_ssm} \title{Particle Smoothing} \usage{ particle_smoother(object, nsim, ...) @@ -15,6 +16,10 @@ particle_smoother(object, nsim, ...) \method{particle_smoother}{ngssm}(object, nsim, filter_type = "bsf", smoothing_method = "fs", seed = sample(.Machine$integer.max, size = 1), max_iter = 100, conv_tol = 1e-08, ...) + +\method{particle_smoother}{nlg_ssm}(object, nsim, filter_type = "psi", + smoothing_method = "fs", seed = sample(.Machine$integer.max, size = 1), + max_iter = 100, conv_tol = 1e-08, iekf_iter = 0, ...) } \arguments{ \item{object}{Model.} @@ -23,6 +28,13 @@ particle_smoother(object, nsim, ...) \item{...}{Ignored.} +\item{filter_type}{Choice of particle filter algorithm. For Gaussian models, +possible choices are \code{"bsf"} (bootstrap particle filter) and +\code{"apf"} (auxiliary particle filter). In addition, for non-Gaussian or +non-linear models, \code{"psi"} uses psi-particle filter, and +for non-linear models options \code{"ekf"} (extended Kalman particle filter) +is also available.} + \item{smoothing_method}{Either \code{"fs"} (filter-smoother), or \code{"fbs"} (forward-backward smoother).} @@ -35,13 +47,6 @@ Default is \code{TRUE}.} \item{conv_tol}{Tolerance parameter used in Gaussian approximation. Used psi-PF.} -\item{filter}{Choice of particle filter algorithm. For Gaussian models, -possible choices are \code{"bsf"} (bootstrap particle filter) and -\code{"apf"} (auxiliary particle filter). In addition, for non-Gaussian or -non-linear models, \code{"psi"} uses psi-particle filter, and -for non-linear models options \code{"ekf"} (extended Kalman particle filter) -is also available.} - \item{iekf_iter}{If zero (default), first approximation for non-linear Gaussian models is obtained from extended Kalman filter. If \code{iekf_iter > 0}, iterated extended Kalman filter is used with diff --git a/man/run_mcmc_ng.Rd b/man/run_mcmc_ng.Rd index 590b4a3b..ce5e421d 100644 --- a/man/run_mcmc_ng.Rd +++ b/man/run_mcmc_ng.Rd @@ -12,7 +12,7 @@ delayed_acceptance = TRUE, n_burnin = floor(n_iter/2), n_thin = 1, gamma = 2/3, target_acceptance = 0.234, S, end_adaptive_phase = TRUE, local_approx = TRUE, n_threads = 1, seed = sample(.Machine$integer.max, - size = 1), ...) + size = 1), max_iter = 100, conv_tol = 1e-08, ...) \method{run_mcmc}{ng_bsm}(object, n_iter, nsim_states, type = "full", method = "pm", simulation_method = "psi", const_m = TRUE, @@ -33,7 +33,7 @@ delayed_acceptance = TRUE, n_burnin = floor(n_iter/2), n_thin = 1, gamma = 2/3, target_acceptance = 0.234, S, end_adaptive_phase = TRUE, n_threads = 1, seed = sample(.Machine$integer.max, size = 1), - max_iter = 100, conv_tol = 1e-08, iekf_iter = 0, ...) + max_iter = 100, conv_tol = 1e-04, iekf_iter = 0, ...) } \arguments{ \item{object}{Model object.} @@ -84,12 +84,12 @@ once at the start of the MCMC. Not used for non-linear models.} \item{seed}{Seed for the random number generator.} -\item{...}{Ignored.} - \item{max_iter}{Maximum number of iterations used in Gaussian approximation. Used psi-PF.} \item{conv_tol}{Tolerance parameter used in Gaussian approximation. Used psi-PF.} +\item{...}{Ignored.} + \item{iekf_iter}{If zero (default), first approximation for non-linear Gaussian models is obtained from extended Kalman filter. If \code{iekf_iter > 0}, iterated extended Kalman filter is used with