Learn R Programming

KFAS (version 0.9.9)

structSSM: Create a Structural Time Series State Space Model

Description

Function structSSM creates a state space representation of structural time series.

Usage

structSSM(y, trend = "level", seasonal = "none",
    X = NULL, H = NULL, Q.level = NULL, Q.slope = NULL,
    Q.seasonal = NULL, Q.regression = NULL, u = NULL,
    distribution = c("Gaussian", "Poisson", "Binomial"),
    transform = c("none", "ldl", "augment"),
    tolF = .Machine$double.eps^0.5,
    tol0 = .Machine$double.eps^0.5)

Arguments

trend
A character vector defining the type of the level component of the model. For multivariate series, either one type, it is assumed that all $p$ series have same type of trend components. Possible values are "level" (local level model)
seasonal
A character vector defining the type of the seasonal component of the model. For multivariate series, it is assumed that all $p$ series have same type of seasonal components. Possible values are "none" (no seasonal), "time"
X
A $n \times k$ matrix of explanatory variables, with each column containing one explanatory variable. It is assumed that all $p$ series use same explanatory variables.
H
A $p \times p$ covariance matrix (or $p \times p \times n$ array in time-varying case) of the disturbance terms $\epsilon_t$ of the observation equation. Default gives $p \times p$ zero matrix. Omitted in case of non-Gaussian distributions. A
Q.level
A scalar or $p \times p$ covariance matrix (or $p \times p \times n$ array in time-varying case) of the disturbance terms $\xi_t$ corresponding to the level process $\mu_t$. Default gives diagonal matrix with NA's on diagonal.
Q.slope
A scalar or $p \times p$ covariance matrix (or $p \times p \times n$ array in time-varying case) of the disturbance terms $\zeta_t$ corresponding to the slope process $\nu_t$. Default gives diagonal matrix with NA's on diagonal. Omitted if
Q.seasonal
scalar or A $p \times p$ covariance matrix (or $p \times p \times n$ array in time-varying case) of the disturbance terms $\omega_t$ corresponding to the seasonal process $\gamma_t$. Default gives diagonal matrix with NA's on diagonal. Omitted
Q.regression
A scalar or $xn \times xn$ covariance matrix (or $xn \times xn \times n$ array in time-varying case) of the disturbance terms corresponding to the regression coefficient processes. Default gives zero matrix i.e. ordinary time-invariant regressi
y
A time series object of class ts, or a object that can be coerced to such.
u
Only used with non-Gaussian distribution. See details.
distribution
Specify the distribution of the observations. Default is "Gaussian".
transform
The functions of KFAS require diagonal covariance matrix $H_t$. If $H_t$ is not diagonal, model can be transformed using one of the two options. Option "ldl" performs LDL decomposition for covariance matrix $H_t$, and m
tolF
Tolerance parameter for Finf. Smallest value not counted for zero.
tol0
Tolerance parameter for LDL decomposition, determines which diagonal values are counted as zero.

Details

The structural time series model has form

$$y_t = \mu_t + \gamma_t + \epsilon_t, \quad \epsilon_t ~ N(0, H_t)$$

$$\mu_{t+1} = \mu_t + \nu_t + \xi_t, \quad \xi_t ~ N(0, Q_{level,t})$$

$$\nu_{t+1} = \nu_t + \zeta_t, \quad \zeta_t ~ N(0, Q_{slope,t})$$

with seasonal component being either time domain form $$\gamma_{t+1} = -\sum_{j=1}^{s-1}\gamma_{t+1-j} + \omega_t, \quad \omega_t ~ N(0,Q_{seasonal,t}),$$

or frequency domain form where

$$\gamma_{t} = \sum_{j=1}^{\lfloor s/2 \rfloor}\gamma_{j,t}$$ $$\gamma_{j,t+1} = \gamma_{j,t} cos\lambda_j + \gamma^{\ast}_{j,t} sin\lambda_j + \omega_{j,t},$$ $$\gamma^{\ast}_{j,t+1} = - \gamma_{j,t} sin\lambda_j + \gamma^{\ast}_{j,t} cos\lambda_j + \omega^\ast_{j,t}, j=1,\ldots, \lfloor s/2 \rfloor,$$ with $\omega_{j,t}$ and $\omega^\ast_{j,t}$ being independently distributed variables with $N(0, Q_{seasonal,t})$ distribution and $\lambda_j = 2\pi j/s$.

Explanatory variables can also be added to the model; in structSSM function it is assumed that same explanatory variables are used for all series. See regSSM and + for more complicated settings.

See Also

arimaSSM for state space representation of ARIMA model, regSSM for state space representation of a regression model, SSModel for custom SSModel object and KFAS for general information regarding the package and examples of its usage.