Learn R Programming

bssm (version 1.0.0)

run_mcmc.gaussian: Bayesian Inference of Linear-Gaussian State Space Models

Description

Bayesian Inference of Linear-Gaussian State Space Models

Usage

# S3 method for gaussian
run_mcmc(
  model,
  iter,
  output_type = "full",
  burnin = floor(iter/2),
  thin = 1,
  gamma = 2/3,
  target_acceptance = 0.234,
  S,
  end_adaptive_phase = TRUE,
  n_threads = 1,
  seed = sample(.Machine$integer.max, size = 1),
  ...
)

Arguments

model

Model model.

iter

Number of MCMC iterations.

output_type

Type of output. Default is "full", which returns samples from the posterior \(p(\alpha, \theta)\). Option "summary" does not simulate states directly but computes the posterior means and variances of states using fast Kalman smoothing. This is slightly faster, more memory efficient and more accurate than calculations based on simulation smoother. Using option "theta" will only return samples from the marginal posterior of the hyperparameters \(\theta\).

burnin

Length of the burn-in period which is disregarded from the results. Defaults to iter / 2. Note that all MCMC algorithms of bssm used adaptive MCMC during the burn-in period in order to find good proposal.

thin

Thinning rate. All MCMC algorithms in bssm use the jump chain representation, and the thinning is applied to these blocks. Defaults to 1.

gamma

Tuning parameter for the adaptation of RAM algorithm. Must be between 0 and 1 (not checked).

target_acceptance

Target acceptance ratio for RAM. Defaults to 0.234.

S

Initial value for the lower triangular matrix of RAM algorithm, so that the covariance matrix of the Gaussian proposal distribution is \(SS'\). Note that for some parameters (currently the standard deviation and dispersion parameters of bsm_lg models) the sampling is done for transformed parameters with internal_theta = log(theta).

end_adaptive_phase

If TRUE (default), $S$ is held fixed after the burnin period.

n_threads

Number of threads for state simulation.

seed

Seed for the random number generator.

...

Ignored.