bsts_trend() is a generic that wraps the various trend models in the bsts package into a user-friendly interface. Model-specific arguments are passed via ...; see the four methods for details of those arguments.

bsts_trend(
  state = list(),
  .data = state[[".data"]],
  method = c("semilocal", "local", "robust", "level"),
  ...
)

# S3 method for semilocal
bsts_trend(
  state = list(),
  .data = state[[".data"]],
  method = "semilocal",
  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
)

# S3 method for local
bsts_trend(
  state = list(),
  .data = state[[".data"]],
  method = "local",
  level.sigma.prior = NULL,
  slope.sigma.prior = NULL,
  initial.level.prior = NULL,
  initial.slope.prior = NULL,
  sdy = NULL,
  initial.y = NULL
)

# S3 method for robust
bsts_trend(
  state = list(),
  .data = state[[".data"]],
  method = "robust",
  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 = NULL,
  initial.y = NULL
)

# S3 method for level
bsts_trend(
  state = list(),
  .data = state[[".data"]],
  method = "level",
  sigma.prior = NULL,
  initial.state.prior = NULL,
  sdy = NULL,
  initial.y = NULL
)

Arguments

state

A list of state components you wish to add to. If omitted, an empty list will be assumed. This argument is named state.specification in bsts.

.data

The time series to be modeled, as a numeric vector. Unlike bsts, this is piped forward as part of the state if defined, so you only need to specify it once (at the beginning of the model-building pipeline).

method

Which trend model to use. Choose from "semilocal" (the default), "local", "robust", or "level".

...

Additional arguments to pass to methods; see the methods above for details

level.sigma.prior

An object created by SdPrior describing the prior distribution for the standard deviation of the level component.

slope.mean.prior

An object created by NormalPrior giving the prior distribution for the mean parameter in the generalized local linear trend model (see below).

slope.ar1.prior

An object created by Ar1CoefficientPrior giving the prior distribution for the ar1 coefficient parameter in the generalized local linear trend model (see below).

slope.sigma.prior

An object created by SdPrior describing the prior distribution of the standard deviation of the slope component.

initial.level.prior

An object created by NormalPrior describing the initial distribution of the level portion of the initial state vector.

initial.slope.prior

An object created by NormalPrior describing the prior distribution for the slope portion of the initial state vector.

sdy

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.

initial.y

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.

save.weights

A logical value indicating whether to save the draws of the weights from the normal mixture representation.

level.nu.prior

An object inheritng from the class DoubleModel, representing the prior distribution on the nu tail thickness parameter of the T distribution for errors in the evolution equation for the level component.

slope.nu.prior

An object inheritng from the class DoubleModel, representing the prior distribution on the nu tail thickness parameter of the T distribution for errors in the evolution equation for the slope component.

sigma.prior

An object created by SdPrior describing the prior distribution for the standard deviation of the random walk increments.

initial.state.prior

An object created using NormalPrior, describing the prior distribution of the initial state vector (at time 1).

Value

A list with the elements necessary to specify the chosen trend model