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

ssm_nlg

General multivariate nonlinear Gaussian state space models


Description

Constructs an object of class ssm_nlg by defining the corresponding terms of the observation and state equation.

Usage

ssm_nlg(
  y,
  Z,
  H,
  T,
  R,
  Z_gn,
  T_gn,
  a1,
  P1,
  theta,
  known_params = NA,
  known_tv_params = matrix(NA),
  n_states,
  n_etas,
  log_prior_pdf,
  time_varying = rep(TRUE, 4),
  state_names = paste0("state", 1:n_states)
)

Arguments

y

Observations as multivariate time series (or matrix) of length n.

Z, H, T, R

An external pointers for the C++ functions which define the corresponding model functions.

Z_gn, T_gn

An external pointers for the C++ functions which define the gradients of the corresponding model functions.

a1

Prior mean for the initial state as a vector of length m.

P1

Prior covariance matrix for the initial state as m x m matrix.

theta

Parameter vector passed to all model functions.

known_params

Vector of known parameters passed to all model functions.

known_tv_params

Matrix of known parameters passed to all model functions.

n_states

Number of states in the model.

n_etas

Dimension of the noise term of the transition equation.

log_prior_pdf

An external pointer for the C++ function which computes the log-prior density given theta.

time_varying

Optional logical vector of length 4, denoting whether the values of Z, H, T, and R vary with respect to time variable (given identical states). If used, this can speed up some computations.

state_names

Names for the states.

Details

The nonlinear Gaussian model is defined as

y_t = Z(t, α_t, θ) + H(t, θ) ε_t, (\textrm{observation equation})

α_{t+1} = T(t, α_t, θ) + R(t, θ)η_t, (\textrm{transition equation})

where ε_t \sim N(0, I_p), η_t \sim N(0, I_m) and α_1 \sim N(a_1, P_1) independently of each other, and functions Z, H, T, R can depend on α_t and parameter vector θ.

Compared to other models, these general models need a bit more effort from the user, as you must provide the several small C++ snippets which define the model structure. See examples in the vignette.

Value

Object of class ssm_nlg.


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.