$$\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)}.$$
The prior distribution for this model has four independent components. There is 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$.
AddGeneralizedLocalLinearTrend(
state.specification,
y,
level.sigma.prior,
slope.mean.prior,
slope.ar1.prior,
slope.sigma.prior,
initial.level.prior,
initial.slope.prior,
sdy,
initial.y)
SdPrior
describing the prior distribution for
the standard deviation of the level component.NormalPrior
giving the prior distribution for
the mean parameter in the generalized local linear trend model (see
below).Ar1CoefficientPrior
giving the prior
distribution for the ar1 coefficient parameter in the generalized
local linear trend model (see below).SdPrior
describing the prior distribution of
the standard deviation of the slope component.NormalPrior
describing the initial distribution
of the level portion of the initial state vector.NormalPrior
describing the prior distribution
for the slope portion of the initial state vector.y
is provided, or if all the required
prior distributions are supplied directly.y
is provided, or if the priors for the initial
state are all provided directly.Durbin and Koopman (2001), "Time series analysis by state space methods", Oxford University Press.
bsts
.
SdPrior
NormalPrior