compare.bsts.models {bsts} | R Documentation |
Produce a set of line plots showing the cumulative absolute one step ahead prediction errors for different models. This plot not only shows which model is doing the best job predicting the data, it highlights regions of the data where the predictions are particularly good or bad.
CompareBstsModels(model.list, burn = SuggestBurn(.1, model.list[[1]]), filename = "", colors = NULL, lwd = 2, xlab = "Time", main = "", grid = TRUE, cutpoint = NULL)
model.list |
A list of |
burn |
The number of initial MCMC iterations to remove from each model as burn-in. |
filename |
A string. If non-empty string then a pdf of the plot will be saved in the specified file. |
colors |
A vector of colors to use for the different lines in the
plot. If |
lwd |
The width of the lines to be drawn. |
xlab |
Label for the horizontal axis. |
main |
Main title for the plot. |
grid |
Logical. Should gridlines be drawn in the background? |
cutpoint |
Either |
Invisibly returns the matrix of cumulative one-step ahead prediction errors (the lines in the top panel of the plot). Each row in the matrix corresponds to a model in model.list.
Steven L. Scott steve.the.bayesian@gmail.com
data(AirPassengers) y <- log(AirPassengers) ss <- AddLocalLinearTrend(list(), y) trend.only <- bsts(y, ss, niter = 250) ss <- AddSeasonal(ss, y, nseasons = 12) trend.and.seasonal <- bsts(y, ss, niter = 250) CompareBstsModels(list(trend = trend.only, "trend and seasonal" = trend.and.seasonal)) CompareBstsModels(list(trend = trend.only, "trend and seasonal" = trend.and.seasonal), cutpoint = 100)