ucm {rucm} | R Documentation |
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 |
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 |
irregular.var |
value to fix variance of irregular component. |
level |
logical; if level is to be included in the model. Defaults to |
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 |
slope.var |
value to fix variance of the slope component. |
season |
logical; if seasonal component is to be included in the model. Defaults to |
season.length |
value of length of seasonal component. Required when |
season.var |
value to fix variance of seasonal component. |
cycle |
logical; if cyclical component is to be included in the model. Defaults to |
cycle.period |
length of cyclical component. Required when |
cycle.var |
value to fix variance of cyclical component. |
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.
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 |
See Also
KFAS
, SSModel
for a detailed discussion on State Space Models.
Examples
modelNile <- ucm(Nile~0, data = Nile, slope = TRUE)
modelNile
modelNile$s.level