stsm: Structural time series models

View source: R/stsm.R

stsmR Documentation

Structural time series models

Description

stsm creates an S3 object representing a time-invariant structural time series model:

Usage

stsm(y, b, C, S, xreg = NULL, bc = FALSE, cform = TRUE)

Arguments

y

an object of class ts.

b

vector of constants.

C

matrix of constants.

S

covariance matrix of the error vector (u_t, v_t).

xreg

matrix of regressors.

bc

logical. If TRUE logs are taken.

cform

logical. If TRUE station equation is given in contemporaneous form, otherwise it is written in future form.

Details

y(t) = b'x(t) + u(t) (observation equation), x(t+j) = Cx(t+j-1) + v(t) (state equation), j = 0 for contemporaneous form or 1 for future form.

Value

An object of class stsm.

References

Durbin, J. and Koopman, S.J. (2012) Time Series Analysis by State Space Methods, 2nd ed., Oxford University Press, Oxford.

Harvey, A.C. (1989) Forecasting, Structural Time Series Models and the Kalman Filter. Cambridge University Press, Cambridge.

Examples

# Local level model
b <- 1
C <- as.matrix(1)
stsm1 <- stsm(Nile, b, C, S = diag(c(irr = 1, lvl = 0.5)) )
stsm1

gallegoj/tfarima documentation built on March 31, 2024, 10:32 a.m.