Description Usage Arguments Details Value Note Author(s) References See Also Examples
Builds an univariate "dummy seasonal" DLM of the specified order.
1 2 3 4 5 6 7 8 9 | 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")
|
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. |
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
.
An object of class dlmodeler
representing the dummy seasonal model.
State representations are not unique, so other forms could be used to achieve the same goals.
Cyrille Szymanski <cnszym@gmail.com>
Durbin, and Koopman, Time Series Analysis by State Space Methods, Oxford University Press (2001), pages 38-45.
dlmodeler
,
dlmodeler.build
,
dlmodeler.build.polynomial
,
dlmodeler.build.tseasonal
,
dlmodeler.build.structural
,
dlmodeler.build.arima
,
dlmodeler.build.regression
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.