bsts_trend.Rd
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
)
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.
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).
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
An object created by
SdPrior
describing the prior
distribution for the standard deviation of the level component.
An object created by
NormalPrior
giving the prior distribution for
the mean parameter in the generalized local linear trend model (see
below).
An object created by
Ar1CoefficientPrior
giving the prior
distribution for the ar1 coefficient parameter in the generalized
local linear trend model (see below).
An object created by
SdPrior
describing the prior distribution of
the standard deviation of the slope component.
An object created by
NormalPrior
describing the initial distribution
of the level portion of the initial state vector.
An object created by
NormalPrior
describing the prior distribution
for the slope portion of the initial state vector.
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.
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.
A logical value indicating whether to save the draws of the weights from the normal mixture representation.
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.
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.
An object created by SdPrior
describing the prior distribution for the standard deviation of the
random walk increments.
An object created using
NormalPrior
, describing the prior distribution
of the initial state vector (at time 1).
A list with the elements necessary to specify the chosen trend model