add.semilocal.linear.trend | R Documentation |
The semi-local linear trend model is similar to the local linear
trend, but more useful for long-term forecasting. It assumes the
level component moves according to a random walk, but the slope
component moves according to an AR1 process centered on a
potentially nonzero value D
. The equation for the level is
\mu_{t+1} = \mu_t + \delta_t + \epsilon_t \qquad \epsilon_t \sim
\mathcal{N(0, \sigma_\mu)}.
The equation for the slope is
\delta_{t+1} = D + \phi
(\delta_t - D) + \eta_t \qquad \eta_t \sim \mathcal{N(0,
\sigma_\delta)}.
This model differs from the local linear trend model in that the
latter assumes the slope \delta_t
follows a random
walk. A stationary AR(1) process is less variable than a random walk
when making projections far into the future, so this model often gives
more reasonable uncertainty estimates when making long term forecasts.
The prior distribution for the semi-local linear trend has four independent components. These are:
an inverse gamma prior on the level
standard deviation \sigma_\mu
,
an inverse gamma prior on the slope standard deviation
\sigma_\delta
,
a Gaussian prior on the long run slope parameter D
,
and a potentially truncated Gaussian prior on the AR1
coefficient \phi
. If the prior on \phi
is
truncated to (-1, 1), then the slope will exhibit short term
stationary variation around the long run slope D
.
AddSemilocalLinearTrend(
state.specification = list(),
y = NULL,
level.sigma.prior = NULL,
slope.mean.prior = NULL,
slope.ar1.prior = NULL,
slope.sigma.prior = NULL,
initial.level.prior = NULL,
initial.slope.prior = NULL,
sdy = NULL,
initial.y = NULL)
state.specification |
A list of state components that you wish to add to. If omitted, an empty list will be assumed. |
y |
The time series to be modeled, as a numeric vector. This can
be omitted if |
level.sigma.prior |
An object created by
|
slope.mean.prior |
An object created by
|
slope.ar1.prior |
An object created by
|
slope.sigma.prior |
An object created by
|
initial.level.prior |
An object created by
|
initial.slope.prior |
An object created by
|
sdy |
The standard deviation of the series to be modeled. This
will be ignored if |
initial.y |
The initial value of the series being modeled. This will be
ignored if |
Returns a list with the elements necessary to specify a generalized local linear trend state model.
Steven L. Scott steve.the.bayesian@gmail.com
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.
bsts
.
SdPrior
NormalPrior
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.