structSSM: Create a Structural Time Series State Space Model

Description Usage Arguments Details See Also

Description

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

Usage

1
2
3
4
5
6
7
  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) and "slope" (local linear trend model). Default is "level".

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" (time domain form) and "time" (frequency domain form). The length of the seasonal pattern is taken as the frequency attribute of the time series object y. Default is "none".

X

A n*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*p covariance matrix (or p*p*n array in time-varying case) of the disturbance terms ε[t] of the observation equation. Default gives p*p zero matrix. Omitted in case of non-Gaussian distributions. Augment the state vector if you want to add additional noise.

Q.level

A scalar or p*p covariance matrix (or p*p*n array in time-varying case) of the disturbance terms ξ[t] corresponding to the level process μ[t]. Default gives diagonal matrix with NA's on diagonal.

Q.slope

A scalar or p*p covariance matrix (or p*p*n array in time-varying case) of the disturbance terms ξ[t] corresponding to the slope process ν[t]. Default gives diagonal matrix with NA's on diagonal. Omitted if trend="level".

Q.seasonal

scalar or A p*p covariance matrix (or p*p*n array in time-varying case) of the disturbance terms ω[t] corresponding to the seasonal process γ[t]. Default gives diagonal matrix with NA's on diagonal. Omitted if seasonal="none". There are several ω[t] processes in the frequency domain case, but they are all identically distributed, so only the (co)variance structure of one of them need to be defined.

Q.regression

A scalar or xn*xn covariance matrix (or xn*xn*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 regression.

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 multiplies the observation equation with the L[t]^{-1}, so ε[t] ~ N(0,D[t]). Option "augment" adds ε[t] to the state vector, when Q[t] becomes block diagonal with blocks Q[t] and H[t]. In case of univariate series, option "ldl" only changes the H_type argument of the model to "Diagonal". Default is "none" which does no transformation but checks if H is diagonal. If not, H_type is set to "Untransformed".

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] = μ[t] + ε[t], ε[t] ~ N(0, H[t])

μ[t+1] = μ[t] + ν[t] + ξ[t], ξ[t] ~ N(0, Q[level,t])

ν[t+1] = ν[t] + ζ[t], ζ[t] ~ N(0, Q[slope,t])

with seasonal component being either time domain form

γ[t+1] = -γ[t] - … - γ[t-s+2] + ω[t], ω[t] ~ N(0,Q[seasonal,t]),

or frequency domain form where

γ[t] = γ[1,t] + … + γ[[s/2],t],

γ_{j,t+1} = γ[j,t] cosλ[j] + γ*[j,t] sinλ[j] + ω[j,t],

γ*[j,t+1] = - γ[j,t] sinλ[j] + γ*[j,t] cosλ[j] + ω*[j,t], j=1,..., [s/2],

with ω[j,t] and ω*[j,t] being independently distributed variables with N(0, Q[seasonal,t]) distribution and λ[j] = 2π 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.


jrnold/KFAS documentation built on May 19, 2019, 11:55 p.m.