bsts.holdout.prediction.errors: One step prediction errors on a holdout sample

Description

Computes the one-step-ahead prediction errors for a model of class bsts on a holdout sample.

Usage

1
2
3
4
bsts.holdout.prediction.errors(bsts.object,
                               newdata,
                               burn = SuggestBurn(.1, bsts.object),
                               na.action = na.omit)

Arguments

bsts.object

An object of class bsts.

newdata

The holdout sample of data. If bsts.object contains a regression component then this must be a data.frame with all the relevant variables in the model formula for bsts.object. Otherwise this should be a numeric vector.

burn

An integer giving the number of MCMC iterations to discard as burn-in. If burn <= 0 then no burn-in sample will be discarded.

na.action

A function determining what should be done with missing values in newdata.

Value

A matrix of draws of the one-step-ahead prediction errors. Rows of the matrix correspond to MCMC draws. Columns correspond to time.

Author(s)

Steven L. Scott stevescott@google.com

References

Harvey (1990), "Forecasting, structural time series, and the Kalman filter", Cambridge University Press.

Durbin and Koopman (2001), "Time series analysis by state space methods", Oxford University Press.

See Also

bsts, AddLocalLevel, AddLocalLinearTrend, AddGeneralizedLocalLinearTrend, SpikeSlabPrior, SdPrior, bsts.prediction.errors.

Examples

1
2
3
4
5
6
7
  data(AirPassengers)
  y <- log(AirPassengers)
  ss <- AddLocalLinearTrend(list(), y)
  ss <- AddSeasonal(ss, y, nseasons = 12)
  model <- bsts(y, state.specification = ss, niter = 500)
  errors <- bsts.prediction.errors(model, burn = 100)
  PlotDynamicDistribution(errors)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.