Learn R Programming

tfarima (version 0.4.1)

uc: Unobservable components

Description

uc creates an S3 object representing a predefined UC (trend, seasonal, cycle, autoregressive and irregular component).

Usage

uc(
  type,
  s2 = NULL,
  s = 12,
  form = c("trig", "dummy"),
  per = 5,
  phi = 0.9,
  counter = 1
)

Value

An object of class uc.

Arguments

type

character. The type of component: trend, seasonal, cycle, AR or irregular.

s2

vector with the variances of the errors driving the UC.

s

integer. Seasonal period for seasonal components.

form

character. The form of the seasonal component (trigonometric or dummy seasonality).

per

numeric. The period of the cycle component.

phi

numeric. The damping factor of the cycle component.

counter

integer. Counter for numbering phi cycle parameters.

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

Run this code
# Trend component
trend <- uc("trend", s2 = c(s2_lvl = 0.5, s2_slp = 0.025))
# Seasonal component
seas <- uc("seasonal", s2 = c(s2_seas = 0.5), s = 12, form = "trig")
# Cycle component
cycle1 <- uc("cycle", s2 = c(s2_c1 = 0.5), per = 5, phi = 0.8)
cycle2 <- uc("cycle", s2 = c(s2_c2 = 0.5), per = 10, phi = 0.8, counter = 2)

Run the code above in your browser using DataLab