Description Usage Arguments Details Value Author(s) References See Also Examples
Robustly filters a given time series assuming an Autoregressive Model. The filtered series can be applied to improve estimations. Optionally, the coefficients of a fitted AR model can be used. See Chapter 8.6 of Maronna et al. (2006) and Dürre et al. (2015) for details.
1 2 3 4 5 6 |
x |
numeric vector of a univariate time series. |
ar |
numeric vector of AR coefficients. If missing, the AR coefficients are estimated by robust filtering with |
var.pred |
numeric value with the innovation variance of the AR model. This argument needs to be provided unless argument |
method |
character string specifying the method applied for robust filtering. If |
locfn |
function which calculates a location estimator for previously centering the time series. Its argument must be a vector of the data. One could for example use the function |
psi.l |
numeric value determining the psi function used for filtering, see |
psi.0 |
numeric value determining the psi function used for filtering, see |
na.action |
function to be called to handle missing values. |
... |
additional arguments passed to function |
This function filters a time series in order to detect and shrink potential outliers. This filtering is based on the assumption that the time series follows an AR process with Gaussian innovations.
If the model coefficients are known or have been previously estimated, one can provide the vector of AR coefficients by the argument ar
. In that case one additionally need to specify the innovation variance by the argument var.pred
. An AR model of order zero (assuming independent innovations) could be specified by ar = NULL
.
If the coefficients are not provided, then in a first step an AR model is fitted to the data. Estimation is done by the function arrob.filter
for which further arguments can be provided by the ...
argument. In this case no additional information on the model fit is returned, e.g. the estimated parameters and the innovation variance. It is difficult to assess the quality of this fit. For this reason it is recommended to fit the model by the function arrob
in a separate step before calling this function and then providing the estimated coefficients and the estimated innovation variance, see Examples.
Based on the model, residuals are calculated and smoothed by a psi function which is given by the argument psifunc
. By default this is M_psi(x, type="smooth")
, a smooth function which is the identity for absolute values smaller than 2 and zero for absolute values larger than 3. See link{smoothpsi}
and Dürre et al. (2015) for a formal definition of this psi function.
The procedure used for robust filtering can be specified by the argument method
and can be one of the following possibilities:
"statespace"
The approach proposed in Chapter 8.6 of Maronna et al. (2006). It employs a state space representation of the model.
"recursive"
A simple strictly recursive approach, where filtering of the observations is only determined by previous but not by successive observations.
Note that this function can be also used to handle missing values. If one replaces missing values with unusually large ones, the algorithm will replace them by best linear predictions.
Named list of the following elements:
filtered |
numeric vector with the robustly filtered version of |
residuals |
residuals of the fitted AR model. |
Alexander Dürre, Tobias Liboschik and Jonathan Rathjens
Dürre, A., Fried, R. and Liboschik, T. (2015): Robust estimation of (partial) autocorrelation, Wiley Interdisciplinary Reviews: Computational Statistics, vol. 7, 205–222, doi: 10.1002/wics.1351.
Maronna, R. A., Martin, R. D., and Yohai, V. J. (2006): Robust Statistics: Theory and Methods, Wiley, chapter 8, doi: 10.1002/0470010940.
The function arrob.filter
estimates an AR model using the robust filter algorithm.
1 2 3 4 5 6 7 8 9 10 | set.seed(1066)
tss <- arima.sim(model = list(ar = 0.6), n = 100)
tss[50] <- 100 # extreme outlier in the data
# With previous model fit:
fit <- arrob(tss, method = "filter")
filterrob(tss, ar = fit$ar, var.pred = fit$var.pred, method = "recursive")
# Without previous model fit:
filterrob(tss, method = "statespace")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.