Add a local level model to a state specification. The local level model assumes the trend is a random walk: $$\alpha_{t+1} = \alpha_t + \epsilon_t \qquad \epsilon_t \sim \mathcal{N}(0,\sigma).$$ The prior is on the \(\sigma\) parameter.
AddLocalLevel(
state.specification,
y,
sigma.prior,
initial.state.prior,
sdy,
initial.y)
A list of state components that you wish to add to. If omitted, an empty list will be assumed.
The time series to be modeled, as a numeric vector.
An object created by SdPrior
describing the prior distribution for the standard deviation of the
random walk increments.
An object created using
NormalPrior
, describing the prior distribution
of the initial state vector (at time 1).
The standard deviation of the series to be modeled. This
will be ignored if y
is provided, or if all the required
prior distributions are supplied directly.
The initial value of the series being modeled. This will be
ignored if y
is provided, or if the priors for the initial
state are all provided 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.