SSModel
SSModel
creates a state space object
object of class SSModel
which can be used as an
input object for various functions of KFAS
package.SSModel(y, Z = NULL, H = NULL, T = NULL, R = NULL,
Q = NULL, a1 = NULL, P1 = NULL, P1inf = 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)
ts
, or a
object that can be coerced to such.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 mSSModel
with elementsZ
, H
, T
,
R
, Q
, a1
, P1
and
P1inf
. Matrix or scalar Z
(array in case of
time-varying Z
) is used to determine the number of
states $m$. If some of the other elements of the
object are missing, SSModel
uses default values
which are identity matrix for T
, R
(or
$k$ first columns of identity matrix) and
P1inf
, and zero matrix for H
, Q
,
P1
and , a1
. If P1
is given and
P1inf
is not, the it is assumed to be zero matrix.
If Q
is given, it is used to define $r$, the
dimensions of Q
, which can be smaller than $m$
(defaults to $m$).The linear Gaussian state space model is given by
$$y_t = Z_t \alpha_t + \epsilon_t,$$
$$\alpha_{t+1} = T_t \alpha_t + R_t \eta_t,$$
where $\epsilon_t ~ N(0,H_t)$, $\eta_t ~ N(0,Q_t)$ and $\alpha_1 ~ N(a_1,P_1)$ independently of each other. In case of non-Gaussian observations, the observation equation is of form $p(y_t|\theta_t) = p(y_t|Z_t\alpha_t)$, with $p(y_t|\theta_t)$ being one of the following:
If observations are Poisson distributed, parameter of Poisson distribution is $u_t\lambda_t$ and $\theta_t = log(\lambda_t)$.
If observations are from binomial distribution, $u$ is a vector specifying number the of trials at times $1,\ldots,n$, and $\theta_t = log[\pi_t/(1-\pi_t)]$, where $\pi_t$ is the probability of success at time $t$.
For non-Gaussian models $u_t=1$ as a default. For Gaussian models, parameter is omitted.
Only univariate observations are supported when observation equation is non-Gaussian.
arimaSSM
for state space representation of
ARIMA model, regSSM
for state space
representation of a regression model, and
structSSM
for structural time series model.