Learn R Programming

bssm (version 1.0.0)

ssm_mlg: General multivariate linear Gaussian state space models

Description

Constructs an object of class ssm_mlg by defining the corresponding terms of the observation and state equation:

Usage

ssm_mlg(
  y,
  Z,
  H,
  T,
  R,
  a1,
  P1,
  init_theta = numeric(0),
  D,
  C,
  state_names,
  update_fn = default_update_fn,
  prior_fn = default_prior_fn
)

Arguments

y

Observations as multivariate time series or matrix with dimensions n x p.

Z

System matrix Z of the observation equation as p x m matrix or p x m x n array.

H

Lower triangular matrix H of the observation. Either a scalar or a vector of length n.

T

System matrix T of the state equation. Either a m x m matrix or a m x m x n array. UPDATE!!

R

Lower triangular matrix R the state equation. Either a m x k matrix or a m x k x n array.

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.

init_theta

Initial values for the unknown hyperparameters theta.

D

Intercept terms for observation equation, given as a p x n matrix.

C

Intercept terms for state equation, given as m x n matrix.

state_names

Names for the states.

update_fn

Function which returns list of updated model components given input vector theta. This function should take only one vector argument which is used to create list with elements named as Z, H T, R, a1, P1, D, and C, where each element matches the dimensions of the original model. If any of these components is missing, it is assumed to be constant wrt. theta.

prior_fn

Function which returns log of prior density given input vector theta.

Value

Object of class ssm_mlg.

Details

$$y_t = D(t,\theta) + Z(t,\theta) \alpha_t + H(t, \theta) \epsilon_t, (\textrm{observation equation})$$ $$\alpha_{t+1} = C(t,\theta) + T(t, \theta) \alpha_t + R(t, \theta)\eta_t, (\textrm{transition equation})$$

where \(\epsilon_t \sim N(0, I_p)\), \(\eta_t \sim N(0, I_m)\) and \(\alpha_1 \sim N(a_1, P_1)\) independently of each other.