bsts.# S3 method for bsts
plot(x, y = c("state", "components", "residuals",
"coefficients", "prediction.errors",
"forecast.distribution",
"predictors", "size", "dynamic", "seasonal", "help"),
...) PlotBstsCoefficients(bsts.object, burn = SuggestBurn(.1, bsts.object),
inclusion.threshold = 0, number.of.variables = NULL, ...)
PlotBstsComponents(bsts.object, burn = SuggestBurn(.1, bsts.object),
time, same.scale = TRUE,
layout = c("square", "horizontal", "vertical"),
style = c("dynamic", "boxplot"),
ylim = NULL, ...)
PlotDynamicRegression(bsts.object, burn = SuggestBurn(.1, bsts.object),
time = NULL, style = c("dynamic", "boxplot"),
layout = c("square", "horizontal", "vertical"),
...)
PlotBstsState(bsts.object, burn = SuggestBurn(.1, bsts.object),
time, show.actuals = TRUE,
style = c("dynamic", "boxplot"),
scale = c("linear", "mean"),
ylim = NULL,
...)
PlotBstsResiduals(bsts.object, burn = SuggestBurn(.1, bsts.object),
time, style = c("dynamic", "boxplot"), ...)
PlotBstsPredictionErrors(bsts.object, burn = SuggestBurn(.1, bsts.object),
time, style = c("dynamic", "boxplot"), ...)
PlotBstsSize(bsts.object, burn = SuggestBurn(.1, bsts.object), style =
c("histogram", "ts"), ...)
PlotSeasonalEffect(bsts.object, nseasons = 7, season.duration = 1,
same.scale = TRUE, ylim = NULL, get.season.name = NULL,
burn = SuggestBurn(.1, bsts.object), ...)
bsts.bsts.TRUE then all the state
components will be plotted with the same scale on the vertical axis.
If FALSE then each component will get its own scale for the
vertical axis.TRUE then actual values from
the fitted series will be shown on the plot.what ==
"coefficients". See the help file for
plot.lm.spike.NULL this specifies the
number of coefficients to plot, taking precedence over
inclusion.threshold. See plot.lm.spike.NULL these will
be inferred from the state components and the same.scale
argument. Otherwise all plots will be created with the same
ylim values.nseasons and season.duration are used
to select the desired one.nseasons and season.duration are used
to select the desired one.POSIXt,
Date, or similar object as an argument, and return
a single string that can be used as a panel title. If
get.season.name is NULL and nseasons is
specified or inferred to be one of the following values, then the
following functions will be used.
PlotDynamicDistributionPlotBstsState invisibly returns the state object being plotted.
PlotBstsState, PlotBstsComponents, and
PlotBstsResiduals all produce dynamic distribution
plots. PlotBstsState plots the aggregate state
contribution (including regression effects) to the mean, while
PlotBstsComponents plots the contribution of each state
component. PlotBstsResiduals plots the posterior
distribution of the residuals given complete data (i.e. looking
forward and backward in time). PlotBstsPredictionErrors
plots filtering errors (i.e. the one-step-ahead prediction errors
given data up to the previous time point).
PlotBstsForecastDistribution plots the one-step-ahead
forecasts instead of the prediction errors.
PlotBstsCoefficients creates a significance plot for
the predictors used in the state space regression model. It is
obviously not useful for models with no regressors.
PlotBstsSize plots the distribution of the number of
predictors included in the model.
PlotSeasonalEffect generates an array of plots showing
how the distibution of the seasonal effect changes, for each season.
bsts
PlotDynamicDistribution
plot.lm.spike data(AirPassengers)
y <- log(AirPassengers)
ss <- AddLocalLinearTrend(list(), y)
ss <- AddSeasonal(ss, y, nseasons = 12)
model <- bsts(y, state.specification = ss, niter = 500)
plot(model, burn = 100)
plot(model, "residuals", burn = 100)
plot(model, "components", burn = 100)
plot(model, "forecast.distribution", burn = 100)
Run the code above in your browser using DataLab