wrm.filter: Weighted Repeated Median Filters for Univariate Time Series

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Filtering procedure based on a weighted version of Siegel's (1982) repeated median (RM) and a moving time window for robust extraction of low frequency components (the signal) in the presence of outliers and shifts. One of several weight functions can be chosen to weight the observations in each time window.

Usage

1
wrm.filter(y, width, weight.type = 1, del = floor(width/2), extrapolate = TRUE)

Arguments

y

a numeric vector or (univariate) time series object.

width

a positive integer defining the window width used for fitting.
If del = floor(width/2) (default) this needs to be an odd number.

weight.type

Indicates the weight function used.

weight.type=0:

equal weighting

weight.type=1:

triangular weights (default)

weight.type=2:

Epanechnikov weights

del

a positve integer (smaller than width) specifying the delay of the signal extraction.
del=0 means online signal extraction without delay.
Default is del=floor(width/2)

.

extrapolate

a logical indicating whether the level estimations should be extrapolated to the edges of the time series.
If del = floor(width/2) (default) the extrapolation consists of the fitted values within the first half of the first window and the last half of the last window; if del=0 the extrapolation consists of the all fitted values within the first time window.

Details

For online signal extraction without time delay, weighted repeated median filtering with triangular weights is recommendable in the presence of isolated outliers and abrupt level shifts since it reacts more quickly to shifts than unweighted repeated median filtering and provides higher efficiencies. The window width should be chosen based on a guess of the minimal time period in which the signal can be approximated by a straight line without abrupt shifts. Better results can be obtained by increasing the delay, but often minimization of the time delay itself is one of the objectives so that one prefers del=0. The procedure replaces missing values by simple extrapolations if these are not within the first time window used for initialization.

For "offline" situations, it is intuitive to set del roughly equal to width/2. If the focus is rather on smoothing than on signal extraction, the Epanechnikov kernel should be used rather than the triangular kernel. In this case one can also use directly function wrm.smooth.

Value

wrm.filter returns an object of class wrm.filter. An object of class wrm.filter is a list containing the following components:

y

the original input time series.

level

the corresponding signal level extracted by the filter.

slope

the corresponding slope within each time window.

del

the parameter specifying the delay of the signal extraction.

width

width of the time window.

weight.type

name of the weight function used for the fit.

The function plot returns a plot showing the original time series with the filtered output.

Author(s)

Roland Fried and Jochen Einbeck

References

These filtering procedures are described and investigated in
Fried, R., Einbeck, J., Gather, U. (2007), Weighted Repeated Median Smoothing and Filtering, Journal of the American Statistical Association 102, 1300-1308.
Preliminary version available as technical report from www.sfb475.uni-dortmund.de/berichte/tr33-05.pdf

See Also

dw.filter, hybrid.filter, wrm.smooth

Examples

1
2
3
4
data(Nile)
nile <- as.numeric(Nile)
obj <- wrm.filter(nile, width=11)
plot(obj)

Example output

Loading required package: robustbase
Loading required package: MASS
Loading required package: lattice

robfilter documentation built on May 2, 2019, 11:10 a.m.