wrm.smooth: Weighted Repeated Median Smoothing

View source: R/wrm-smooth.R

wrm.smoothR Documentation

Weighted Repeated Median Smoothing

Description

A robust smoothing tool using a kernel weighted version of Siegel's (1982) repeated median. It can be seen as an alternative to local linear L1 regression.

Usage

wrm.smooth(x, y, h, xgrid, weight = 2)

Arguments

x

Vector of predictors.

y

Vector of responses, needs to have the same length as x.

h

Bandwidth, measured in the same units as the explanatory (independent) variable x: (x[0]-h,x[0]+h) is the range of x-values to be included in the local smoothing at x[0]. Needs to be a positive number.

xgrid

Grid on which fitted values are to be evaluated. The default is here to take the input values x for a sample size of at most 100, and seq(min(x),max(x), l=100) otherwise.

weight

Indicates the weight function used.

weight=1

triangular weights

weight=2

Epanechnikov weights (default)

weight=3

Gaussian weights

weight=4

Biweight

weight=5

Uniform weights

Details

Weighted repeated median (WRM) smoothing was suggested in a signal extraction framework by Fried, Einbeck & Gather (2007). It combines the advantages of weighted and repeated medians, i.e. the WRM smoother is robust to outliers and adapts to linear trends (through the slope parameter of the repeated median, which is calculated by applying two consecutive weighted medians onto the pairwise slopes). The theory and simulations provided by Fried, Einbeck & Gather focus on online signal extraction from time series. Warning: The case of a kernel weighted repeated median smoother for arbitraty non-equidistant design (as implemented here) is not fully investigated yet.

The procedure copes with missing values by omitting them.

Value

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

y

the original input time series.

level

the corresponding signal level extraceted by the weighted Repeated Median filter.

slope

the corresponding WRM slope within each time window.

h

bandwidth.

xgrid

vector with grid values.

weight

name of the weight function used for the fit.

The function plot returns a plot showing the original data with the smoothed output.

Author(s)

Jochen Einbeck and Roland Fried

References

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 https://eldorado.tu-dortmund.de/handle/2003/21637

Siegel, A.F. (1982). Robust regression using repeated medians. Biometrika 68, 242-244.

See Also

wrm.filter

Examples

data(faithful) # Old Faithful Geyser data
faith.WRM <- wrm.smooth(faithful$w, faithful$e,h=4)
plot(faith.WRM)

robfilter documentation built on Sept. 11, 2024, 6:05 p.m.