Learn R Programming

bsts (version 0.9.5)

add.static.intercept: Static Intercept State Component

Description

Adds a static intercept term to a state space model. If the model includes a traditional trend component (e.g. local level, local linear trend, etc) then a separate intercept is not needed (and will probably cause trouble, as it will be confounded with the initial state of the trend model). However, if there is no trend, or the trend is an AR process centered around zero, then adding a static intercept will shift the center to a data-determined value.

Usage

AddStaticIntercept(
    state.specification,
    y,
    initial.state.prior = NormalPrior(y[1], sd(y, na.rm = TRUE)))

Arguments

state.specification

A list of state components that you wish to add to. If omitted, an empty list will be assumed.

y

The time series to be modeled, as a numeric vector.

initial.state.prior

An object created using NormalPrior, describing the prior distribution of the intecept term.

Value

Returns a list with the information required to specify the state component. If initial.state.prior is specified then y is unused.

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. SdPrior NormalPrior