wrm.smooth | R Documentation |
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.
wrm.smooth(x, y, h, xgrid, weight = 2)
x |
Vector of predictors. |
y |
Vector of responses, needs to have the same length as |
h |
Bandwidth, measured in the same units as the explanatory (independent) variable x:
(x[0]- |
xgrid |
Grid on which fitted values are to be evaluated. The default is here to take the input
values |
weight |
Indicates the weight function used.
|
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.
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.
Jochen Einbeck and Roland Fried
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.
wrm.filter
data(faithful) # Old Faithful Geyser data
faith.WRM <- wrm.smooth(faithful$w, faithful$e,h=4)
plot(faith.WRM)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.