Learn R Programming

bsts (version 0.6.1)

plot.seasonal.effect: Plot bsts seasonal effects

Description

Plot the seasonal effect from a bsts model.

Usage

PlotSeasonalEffect(model, nseasons = 7, season.duration = 1,
                   same.scale = TRUE, ylim = NULL, getname = NULL, ...)

Arguments

model
A model fit by bsts, containing a seasonal component.
nseasons
If there is only one seasonal component in the model, this argument is ignored. If there are multiple seasonal components then nseasons and season.duration are used to select the desired one.
season.duration
If there is only one seasonal component in the model, this argument is ignored. If there are multiple seasonal components then nseasons and season.duration are used to select the desired one.
same.scale
A logical indicating how to scale the vertical axis if ylim is unspecified. If TRUE then all panels will have the same scale. If FALSE then each panel is scaled independently. If ylim is s
ylim
A length 2 vector giving the limits of the vertical axis.
getname
A function taking a single POSIXt, Date, or similar object as an argument, and returning a single string that can be used as a panel title.
...
Extra arguments passed to plot.dynamic.distribution.

Value

  • Returns invisible{NULL}.

See Also

bsts PlotDynamicDistribution

Examples

Run this code
data(AirPassengers)
  y <- log(AirPassengers)
  ss <- AddLocalLinearTrend(list(), y)
  ss <- AddSeasonal(ss, y, nseasons = 12)
  model <- bsts(y, state.specification = ss, niter = 500)
  PlotSeasonalEffect(model)

Run the code above in your browser using DataLab