1
$\begingroup$

In the vignette for the R package dlm: link on page 12, the author runs the function dlmSmooth to smooth the data and the function returns an object which is assigned to gasSmooth. Now, gasSmooth$s is described in the package help as:

Time series (or matrix) of smoothed values of the state vectors. The series starts one time unit before the first observation.

They say:

Based on the fitted model, we can compute the smoothing estimates of the states. This can be used to obtain a decomposition of the data into a smooth trend plus a stochastic seasonal component, subject to measurement error.

and then run:

gasSmooth <- dlmSmooth(lGas, mod = dlmGas)
x <- cbind(lGas, dropFirst(gasSmooth$s[,c(1,3)]))
colnames(x) <- c("Gas", "Trend", "Seasonal")

The author in the vignette selects to plot columns 1 and 3 of this timeseries matrix, but how do they know that these states represent the smoothed trend and the seasonal trend?

$\endgroup$
0
$\begingroup$

Have a look this : http://gradientdescending.com/state-space-models-for-time-series-analysis-and-the-dlm-package/

it says "The main output here is s. Again there are 13 columns, the first 2 from the linear trend model and the last columns from the seasonal component."

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.