Computes the log-likelihood of the state space model of bssm
package.
Computes the log-likelihood of the state space model of bssm
package.
# 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),
...
)
Model model.
Ignored.
Number of samples for particle filter or importance sampling. If 0, approximate log-likelihood based on the gaussian approximation is returned.
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).
Maximum number of iterations for gaussian approximation algorithm.
Tolerance parameter for the approximation algorithm.
Seed for the random number generator.
# 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