SS {sspir}R Documentation

Representation of Gaussian State Space Model

Description

Creates an SS-object describing a Gaussian state space model.

Usage

SS(y = NA, x = NA,
   Fmat = function(tt, x, phi) { NA },
   Gmat = function(tt, x, phi) { NA },
   Vmat = function(tt, x, phi) { NA },
   Wmat = function(tt, x, phi) { NA },
   m0 = 0, C0 = NA,
   phi = NA)

Arguments

y a matrix giving a multivariate time series of observations. The observation at time tt is y[,tt]. The dimension of y is d times n.
x a list of entities (eg. covariates) passed as argument to the functions Fmat, Gmat, Vmat, and Wmat.
Fmat a function depending on the parameter-vector phi, covariates x and returns the p times d design matrix at time tt.
Gmat a function depending on the parameter-vector phi, covariates x and returns the p times p evolution matrix at time tt.
Vmat a function depending on the parameter-vector phi, covariates x and returns the d times d (positive definit) variance matrix at time tt.
Wmat a function depending on the parameter-vector phi, covariates x and returns the p times p (positive semidefinite) evolution variance matrix at time tt.
m0 a p times 1 matrix giving the initial state.
C0 a p times p variance matrix giving the variance matrix of the initial state.
phi a parameter vector passed as argument to the functions Fmat, Gmat, Vmat, and Wmat.

Details

The state space model is given by

Y_t = F_t^T * theta_t + v_t, v_t ~ N(0,V_t)

theta_t = G_t * theta_{t-1} + w_t, w_t ~ N(0,W_t)

for t=1,...,n. The matrices F_t, G_t, V_t, and W_t may depend on a parameter vector phi. The initialization is given as

theta_0 ~ N(m_0,C_0).

Value

An object of class SS, which is a list with the following components

y as input.
x as input.
Fmat as input.
Gmat as input.
Vmat as input.
Wmat as input.
m0 as input.
C0 as input.
phi as input.
n the number of time points
d the dimension of each observation.
p the dimension of the state vector at each timepoint.
ytilde for use in the extended Kalman filter.
iteration for use in the extended Kalman filter.
m after Kalman filtering (or smoothing), holds the conditional mean of the state vectors given the observations up til time t (filtering) or all observations (smoothing). This is organised in a p times n dimensional matrix holding m_t (m_t^*) in columns.
C after Kalman filtering (or smoothing), holds the conditional variance of the state vectors given the observations up til time t (filtering) or all observations (smoothing). This is organised in a list holding the p times p dimensional matrices C_t (C_t^*).
mu after Kalman smoothing, holds the conditional mean of the signal (μ_t=F_t^top theta_t) given all observations. This is organised in a d times n dimensional matrix holding μ_t in columns.
likelihood the log-likelihood value after Kalman filtering.

Author(s)

Claus Dethlefsen and Søren Lundbye-Christensen

See Also

ssm for a glm-like interface of specifying models, kfilter for Kalman filter and smoother for Kalman smoother.

Examples

time <- 1:length(UKgas)
gasmodel <- ssm( log10(UKgas) ~ -1+
                 tvar(polytime(time,1))+
                 tvar(sumseason(time,12)),time=time)

gasmodel$ss$phi <- StructTS(log10(UKgas),type="BSM")$coef[c(4,1,2,3)]

fit <- kfs(gasmodel)

plot( ts( t(fit$m[1:3,]) ) )

[Package sspir version 0.1.0 Index]