filtering(x, mod, trend = list(ar=1, ma=1, sigma2=NULL), transitory = list(ar=1, ma=1, sigma2=NULL), seasonal = list(ar=1, ma=1, sigma2=NULL), irregular.sigma2 = NULL, extend = 16, drift = FALSE)
dsfilter(x, w, mod, extend = 16)Arima. See arima.NULL, the
estimate of the irregular component is not computed.mod.TRUE the intercept in the fitted model mod or an
external regressor named "drift" is treated as a deterministic linear trend.filtering returns a list of class tsdecFilter containing
the series extended with forecasts (if extend > 0)
(based on the ARMA model given as input),
the weights of one side of the filter for each component
and the corresponding estimate of the components.dsfilter returns the filtered time series.
stats::filter(c(rep(0, n-1), x, rep(0, n-1)),
+ filter=c(rev(w[-1]), w), method="convolution", sides=1)
where n is length(x).
The design of the filter in the ARIMA-model-based decomposition procedure relies on the following result. The minimum mean squared error estimator of the component is given by the ACGF of the model:
$$% \theta(L)x_t = \phi_n(L)\theta_s(L)a_t \,,$$
where $theta(L)$ is the MA of the model fitted to the observed data, $theta_s(L)$ is the MA of the component (signal) to be estimated and $phi_n(L)$ is the product of the AR polynomials of the remaining components. The estimate of the signal, $s[t]$, is obtained by means of a double-sided symmetrical filter where the weights, $w$, are the theoretical autocovariances of the model above:
$$% \hat{s}_t = \sum_{i=-\infty}^\infty w_i x_{t-i} \,.$$
ARIMAdec, filter.