Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sim_smoother

Simulation Smoothing


Description

Function sim_smoother performs simulation smoothing i.e. simulates the states from the conditional distribution p(α | y, θ) for linear-Gaussian models.

Usage

sim_smoother(model, nsim, seed, use_antithetic = FALSE, ...)

## S3 method for class 'gaussian'
sim_smoother(
  model,
  nsim = 1,
  seed = sample(.Machine$integer.max, size = 1),
  use_antithetic = FALSE,
  ...
)

## S3 method for class 'nongaussian'
sim_smoother(
  model,
  nsim = 1,
  seed = sample(.Machine$integer.max, size = 1),
  use_antithetic = FALSE,
  ...
)

Arguments

model

Model object.

nsim

Number of independent samples.

seed

Seed for the random number generator.

use_antithetic

Use an antithetic variable for location. Default is FALSE. Ignored for multivariate models.

...

Ignored.

Details

For non-Gaussian/non-linear models, the simulation is based on the approximating Gaussian model.

Value

An array containing the generated samples.

Examples

model <- bsm_lg(rep(NA, 50), sd_level = uniform(1,0,5), sd_y = uniform(1,0,5))
sim <- sim_smoother(model, 12)
ts.plot(sim[, 1, ])

bssm

Bayesian Inference of Non-Linear and Non-Gaussian State Space Models

v1.1.4
GPL (>= 2)
Authors
Jouni Helske [aut, cre] (<https://orcid.org/0000-0001-7130-793X>), Matti Vihola [aut] (<https://orcid.org/0000-0002-8041-7222>)
Initial release
2021-04-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.