plot.bsts.predictors function

Plot the most likely predictors

Plot the most likely predictors

Creates a time series plot showing the most likely predictors of a time series used to fit a bsts object.

PlotBstsPredictors(bsts.object, burn = SuggestBurn(.1, bsts.object), inclusion.threshold = .1, ylim = NULL, flip.signs = TRUE, show.legend = TRUE, grayscale = TRUE, short.names = TRUE, ...)

Arguments

  • bsts.object: An object of class bsts.
  • burn: The number of observations you wish to discard as burn-in.
  • inclusion.threshold: Plot predictors with marginal inclusion probabilities above this threshold.
  • ylim: Scale for the vertical axis.
  • flip.signs: If true then a predictor with a negative sign will be flipped before being plotted, to better align visually with the target series.
  • show.legend: Should a legend be shown indicating which predictors are plotted?
  • grayscale: Logical. If TRUE then lines for different predictors grow progressively lighter as their inclusion probability decreases. If FALSE then lines are drawn in black.
  • short.names: Logical. If TRUE then a common prefix or suffix shared by all the variables will be discarded.
  • ...: Extra arguments to be passed to plot.

Examples

data(AirPassengers) y <- log(AirPassengers) lag.y <- c(NA, head(y, -1)) ss <- AddLocalLinearTrend(list(), y) ss <- AddSeasonal(ss, y, nseasons = 12) ## Call bsts with na.action = na.omit to omit the leading NA in lag.y model <- bsts(y ~ lag.y, state.specification = ss, niter = 500, na.action = na.omit) plot(model, "predictors")

See Also

bsts

PlotDynamicDistribution

plot.lm.spike

  • Maintainer: Steven L. Scott
  • License: LGPL-2.1 | MIT + file LICENSE
  • Last published: 2024-01-17

Useful links