Learn R Programming

bssm (version 1.1.5)

logLik.nongaussian: Log-likelihood of a Non-Gaussian State Space Model

Description

Computes the log-likelihood of a non-Gaussian state space model of bssm package.

Usage

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

Arguments

object

Model model.

particles

Number of samples for particle filter or importance sampling. If 0, approximate log-likelihood based on the Gaussian approximation is returned.

method

Sampling method, default is psi-auxiliary filter ("psi"), other choices are "bsf" bootstrap particle filter, and "spdk", which uses the importance sampling approach by Shephard and Pitt (1997) and Durbin and Koopman (1997).

max_iter

Maximum number of iterations for Gaussian approximation algorithm.

conv_tol

Tolerance parameter for the approximation algorithm.

seed

Seed for the random number generator.

...

Ignored.

Examples

Run this code
# NOT RUN {
model <- ssm_ung(y = c(1,4,3), Z = 1, T = 1, R = 0.5, P1 = 2,
  distribution = "poisson")
  
model2 <- bsm_ng(y = c(1,4,3), sd_level = 0.5, P1 = 2,
  distribution = "poisson")
logLik(model, particles = 0)
logLik(model2, particles = 0)
logLik(model, particles = 10, seed = 1)
logLik(model2, particles = 10, seed = 1)
# }

Run the code above in your browser using DataLab