## 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)
Run the code above in your browser using DataLab