Description Usage Arguments Value Author(s) References See Also Examples
Add a local level model to a state specification. The local linear trend model assumes that both the mean and the slope of the trend follow random walks. The equation for the mean is
mu[t+1] = mu[t] + delta[t] + sigma.level * rt(1, nu.level).
The equation for the slope is
delta[t+1] = delta[t] + sigma.slope * rt(1, nu.slope).
Independent prior distributions are assumed on the level standard deviation, sigma.level the slope standard deviation sigma.slope, the level tail thickness nu.level, and the slope tail thickness nu.slope.
1 2 3 4 5 6 7 8 9 10 11 12  |   AddStudentLocalLinearTrend(
     state.specification = NULL,
     y,
     save.weights = FALSE,
     level.sigma.prior = NULL,
     level.nu.prior = NULL,
     slope.sigma.prior = NULL,
     slope.nu.prior = NULL,
     initial.level.prior = NULL,
     initial.slope.prior = NULL,
     sdy,
     initial.y)
 | 
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.  | 
save.weights | 
 A logical value indicating whether to save the draws of the weights from the normal mixture representation.  | 
level.sigma.prior | 
 An object created by
  | 
level.nu.prior | 
 An object inheritng from the class
  | 
slope.sigma.prior | 
 An object created by
  | 
slope.nu.prior | 
 An object inheritng from the class
  | 
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 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.
1 2 3 4 5  |   data(rsxfs)
  ss <- AddStudentLocalLinearTrend(list(), rsxfs)
  model <- bsts(rsxfs, state.specification = ss, niter = 500)
  pred <- predict(model, horizon = 12, burn = 100)
  plot(pred)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.