Learn R Programming

bsts (version 0.9.5)

residuals.bsts: Residuals from a bsts Object

Description

Residuals (or posterior distribution of residuals) from a bsts object.

Usage

# S3 method for bsts
residuals(object,
    burn = SuggestBurn(.1, object),
    mean.only = FALSE,
    …)

Arguments

object

An object of class bsts created by the function of the same name.

burn

The number of MCMC iterations to discard as burn-in.

mean.only

Logical. If TRUE then the mean residual for each time period is returned. If FALSE then the full posterior distribution is returned.

Not used. This argument is here to comply with the signature of the generic residuals function.

Value

If mean.only is TRUE then this function returns a vector of residuals with the same "time stamp" as the original series. If mean.only is FALSE then the posterior distribution of the residuals is returned instead, as a matrix of draws. Each row of the matrix is an MCMC draw, and each column is a time point. The colnames of the returned matrix will be the timestamps of the original series, as text.

See Also

bsts, plot.bsts.