Learn R Programming

rucm (version 0.6)

ucm: Unobserved components methods for a time series

Description

Function ucm decomposes a time series into components such as trend, seasonal, cycle, and the regression effects due to predictor series using Unobserved Components Model (UCM).

Usage

ucm(formula, data, irregular = TRUE, irregular.var = NA, level = TRUE, level.var = NA, slope = FALSE, slope.var = NA, season = FALSE, season.length = NA, season.var = NA, cycle = FALSE, cycle.period = NA, cycle.var = NA)

Arguments

formula
an object of class formula containing the symbolic description of the model with dependent and independent terms. If there are no independent terms, replace rhs with 0.
data
a required data frame or list containing variables in the model.
irregular
logical; if irregular component is to be included in the model. Defaults to TRUE.
irregular.var
value to fix variance of irregular component.
level
logical; if level is to be included in the model. Defaults to TRUE.
level.var
value to fix variance of level component.
slope
logical; if slope is to be included in the model along with level. Defaults to FALSE.
slope.var
value to fix variance of the slope component.
season
logical; if seasonal component is to be included in the model. Defaults to FALSE.
season.length
value of length of seasonal component. Required when season is included.
season.var
value to fix variance of seasonal component.
cycle
logical; if cyclical component is to be included in the model. Defaults to FALSE.
cycle.period
length of cyclical component. Required when cycle is included.
cycle.var
value to fix variance of cyclical component.

Value

object of class ucm, which is a list with the following components:
est
Estimates of predictor variables, if present.
irr.var
Estimated variance of irregular component, if present.
est.var.level
Estimated variance of the level component, if present.
est.var.slope
Estimated variance of slope of the level, if present.
est.var.season
Estimated variance of the seasonal component, if present.
est.var.cycle
Estimated variance of the cyclical component, if present.
s.level
An object of the same class as of dependent variable containing the time varying level values, if level is present.
s.lope
An object of the same class as of dependent variable containing the time varying slope values, if slope is present.
s.season
An object of the same class as of dependent variable containing the time varying seasonal values, if season is present.
s.cycle
An object of the same class as of dependent variable containing the time varying cyclical values, if cycle is present.
vs.level
A vector containing time varying estimated variance of level, if level is present.
vs.slope
A vector containing time varying estimated variance of slope, if slope is present.
vs.season
A vector containing time varying estimated variance of seasonal component, if season is present.
vs.cycle
A vector containing time varying estimated variance of cyclical component, if cycle is present.
call
Original call of the function.
model
The original model of class SSModel from KFAS package.

Details

Formula of the model can be of the forma as in lm with response variable on rhs and predictor variables or 0 (if no predictor variables) on the rhs.

See Also

KFAS, SSModel for a detailed discussion on State Space Models.

Examples

Run this code
modelNile <- ucm(Nile~0, data = Nile, slope = TRUE)
modelNile
modelNile$s.level

Run the code above in your browser using DataLab