Learn R Programming

dlmodeler (version 1.4-2)

dlmodeler.build.dseasonal: Build a "dummy seasonal" model

Description

Builds an univariate "dummy seasonal" DLM of the specified order.

Usage

dlmodeler.dseasonal(ord, sigmaH = NA, sigmaQ = 0, name = "dseasonal")
deterministic.season(ord, name="deterministic season") stochastic.season(ord, name="stochastic season")
# old function name dlmodeler.build.dseasonal(ord, sigmaH = NA, sigmaQ = 0, name = "dseasonal")

Arguments

ord
period of the seasonal pattern.
sigmaH
std dev of the observation disturbance (if unknown, set to NA and use dlmodeler.fit to estimate it). Default = NA.
sigmaQ
std dev of the state disturbance (if unknown, set to NA and use dlmodeler.fit to estimate it). Default = 0.
name
an optional name to be given to the resulting DLM.

Value

An object of class dlmodeler representing the dummy seasonal model.

Details

The seasonal pattern is represented by ord seasonal indices $a[1], a[2], ..., a[ord]$. The indices are constrained such that their sum equals 0, with $a[ord] = -a[1] - a[2] - a[3] ... -a[ord-1]$. This only requires ord-1 state variables.

The initial value P0inf is parametered to use exact diffuse initialisation (if supported by the back-end).

The deterministic season model, is a special case of the dseasonal model, where sigmaH=0 and sigmaQ=0.

The stochastic season model, is a special case of the dseasonal model, where sigmaH=0 and sigmaQ=NA.

References

Durbin, and Koopman, Time Series Analysis by State Space Methods, Oxford University Press (2001), pages 38-45.

See Also

dlmodeler, dlmodeler.build, dlmodeler.build.polynomial, dlmodeler.build.tseasonal, dlmodeler.build.structural, dlmodeler.build.arima, dlmodeler.build.regression

Examples

Run this code
## Not run: 
# require(dlmodeler)
# 
# # generate some quarterly data
# n <- 80
# level <- 12
# sigma <- .75
# season <- c(5,6,8,2)
# y <- level + rep(season,n/4) + rnorm(n, mean=0, sd=sigma)
# 
# # deterministic level + quarterly seasonal + disturbance
# mod <- dlmodeler.build.polynomial(0,sigmaH=sigma) +
#        dlmodeler.build.dseasonal(4,sigmaH=0)
# f <- dlmodeler.filter(y, mod)
# 
# # show the one step ahead forecasts
# plot(y,type='l')
# lines(f$f[1,],col='light blue')
# ## End(Not run)

Run the code above in your browser using DataLab