bsts_season() is a generic that wraps the two seasonal models in the bsts package into a user-friendly interface. Model-specific arguments are passed via ...; see the two methods for details of those arguments. bsts_seasonal() also uses the timetk package to make model specification easier or, if you prefer, automate it entirely based on tunable heuristics.

bsts_season(
  state = list(),
  .data = state[[".data"]],
  method = c("regression", "harmonic", "dynamic"),
  period = NULL,
  season = NULL,
  sigma.prior = NULL,
  initial.state.prior = NULL,
  sdy = NULL
)

# S3 method for regression
bsts_season(
  state = list(),
  .data = state[[".data"]],
  method = "regression",
  period = NULL,
  season = NULL,
  sigma.prior = NULL,
  initial.state.prior = NULL,
  sdy = NULL
)

# S3 method for harmonic
bsts_season(
  state = list(),
  .data = state[[".data"]],
  method = "harmonic",
  period = NULL,
  season = NULL,
  sigma.prior = NULL,
  initial.state.prior = NULL,
  sdy = 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 seasonal model to use. Choose from "regression" or "harmonic"; "dynamic" will be implemented in the future.

period

The length of a full seasonal cycle. Either a time-based definition (e.g. "1 week") or the number of observations in a season (e.g. 7). Supplying a number makes this equivalent to nseasons in AddSeasonal() or period in AddTrig() (for methods regression or harmonic, respectively).

season

The length of a season within a period (e.g. "1 month" for a 1 year period with monthly seasonality); the default is one season per observation within a period. Can be supplied in the same way as period. This parameter is ignored for method = "harmonic".

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 by NormalPrior() describing the prior distribution of the the initial state vector (at time 1)

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

Value

A list with the updated state specification of a bsts model

See also

Other bsts: bsts_trend()