Free Access Week-  Data Engineering + BI
Data engineering and BI courses are free!
Free AI Access Week from June 2-8

bssm (version 1.0.0)

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

Description

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

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

Usage

# S3 method for gaussian
logLik(object, ...)

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

Arguments

object

Model model.

...

Ignored.

nsim

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.

Examples

Run this code
# NOT RUN {
model <- ssm_ulg(y = c(1,4,3), Z = 1, H = 1, T = 1, R = 1)
logLik(model)
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, nsim = 0)
logLik(model2, nsim = 0)
logLik(model, nsim = 10)
logLik(model2, nsim = 10)
# }

Run the code above in your browser using DataLab