Add a shared local level model to a state specification. The shared local level model assumes the trend is a multivariate random walk:
$$\alpha_{t+1} = \alpha_t + \eta_t \qquad \eta_{tj} \sim \mathcal{N}(0,\sigma_j).$$
The contribution to the mean of the observed series obeys $$y_{t}
= B \alpha_t + \epsilon_t.$$ plus
observation error. Identifiability constraints ipmly that the
observation coefficients B
form a rectangular lower triangular
matrix with diagonal 1.0.
AddSharedLocalLevel(
state.specification,
response,
nfactors,
sigma.prior = NULL,
coefficient.prior = NULL,
initial.state.prior = NULL,
timestamps = NULL,
series.id = NULL,
sdy)
A pre-existing list of state components that you wish to add to. If omitted, an empty list will be assumed.
The time series to be modeled. This can either be a
matrix with rows as time and columns as series, or it can be a numeric
vector. If a vector is passed then timestamps
and
series.id
are required. Otherwise they are unused.
The number of latent factors to include in the model. This is the dimension of the state for this model component.
There are three options for this argument, which
specifies a prior distribution on the standard deviation of the
innovation errors. It can be NULL
, in which case a default
prior is used. It can be an object of class
SdPrior
, in which case the same prior will be
used for all residual variance parameters. In its most general form
it can be a list of SdPrior
objects, specifying
independent priors on the innovation standard deviations.
Prior distribution on the observation
coefficients. This currently must be a
ScaledMatrixNormalPrior
. Expect other choices
in the future.
An object of class
MvnPrior
, describing the prior distribution of
the initial state vector (at time 1).
If response
is in long format (i.e. a vector
instead of a matrix) this argument is a vector of the same
length indicating the time index to which each element of
response
belongs.
If response
is in long format (i.e. a vector
instead of a matrix) this argument is a vector of the same length
indicating the time series to which each element of response
belongs.
A vector giving the standard deviation of each series to be
modeled. This argument is only necessary if response
cannot
be supplied directly.
Returns a list with the elements necessary to specify a local linear trend state model.
Harvey (1990), "Forecasting, structural time series, and the Kalman filter", Cambridge University Press.
Durbin and Koopman (2001), "Time series analysis by state space methods", Oxford University Press.