Description Usage Arguments Details Value Note Author(s) References See Also Examples
Builds a DLM for a structural time series, consisting of a polynomial term (level, trend, ...), a "dummy seasonal" pattern, a trigonometric cycle term, and an observation disturbance.
1 2 3 4 5 6 7 8 9 10 11 | dlmodeler.structural(pol.order = NULL, dseas.order = NULL,
tseas.period = NULL, tseas.order = NULL,
sigmaH = NA, pol.sigmaQ = 0,
dseas.sigmaQ = 0, tseas.sigmaQ = 0,
name = "structural")
dlmodeler.build.structural(pol.order = NULL, dseas.order = NULL,
tseas.period = NULL, tseas.order = NULL,
sigmaH = NA, pol.sigmaQ = 0,
dseas.sigmaQ = 0, tseas.sigmaQ = 0,
name = "structural")
|
pol.order |
order of the polynomial (0=constant, 1=linear, 2=cubic...), or |
dseas.order |
period of the dummy seasonal pattern, or |
tseas.period |
period of the trigonometric seasonal pattern, or |
tseas.order |
number of harmonics in the trigonometric seasonal pattern, or |
sigmaH |
std dev of the observation disturbance (if unknown, set to NA and use dlmodeler.fit to estimate it). Default = NA. |
pol.sigmaQ |
std dev of the polynomial state disturbances (if unknown, set to NA and use dlmodeler.fit to estimate it). Default = 0. |
dseas.sigmaQ |
std dev of the dummy seasonal state disturbances (if unknown, set to NA and use dlmodeler.fit to estimate it). Default = 0. |
tseas.sigmaQ |
std dev of the trigonometric seasonal state disturbances (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 initial value P0inf
is parametered to use exact diffuse initialisation
(if supported by the back-end).
An object of class dlmodeler
representing the structural model.
This object can have the following components:
level |
component representing the level (when |
level+trend |
component representing the level+trend (when |
polynomial |
component representing the level, trend, ... (when |
seasonal |
component representing the dummy seasonal pattern |
trigonometric |
component representing the trigonometric seasonal pattern |
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.dseasonal
,
dlmodeler.build.tseasonal
,
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 21 22 23 24 25 26 | ## 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
mod <- dlmodeler.build.structural(pol.order=0, dseas.order=4,
sigmaH=sigma)
f <- dlmodeler.filter(y, mod)
# show the one step ahead forecasts
par(mfrow=c(2,1))
plot(y,type='l')
lines(f$f[1,],col='light blue')
# show the filtered level and seasonal components
c <- dlmodeler.extract(f,mod,type="state")
lines(c$level[1,],col='blue')
plot(c$seasonal[1,],type='l',col='dark green')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.