add.semilocal.linear.trend  R Documentation 
The semilocal linear trend model is similar to the local linear trend, but more useful for longterm 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] + rnorm(1, 0, sigma.level)
The equation for the slope is
delta[t+1] = D + phi * (delta[t]  D) + rnorm(1, 0, sigma.slope).
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 semilocal linear trend has four independent components. These are:
an inverse gamma prior on the level standard deviation sigma.level,
an inverse gamma prior on the slope standard deviation sigma.slope,
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.