Procedures for robust extraction of low frequency components (the signal) from a univariate time series based on a moving window technique using the median of several one-sided half-window estimates (subfilters) in each step.
a numeric vector or (univariate) time series object.
an odd positive integer (>=3) defining the window width used for fitting.
a (vector of) character string(s) containing the method(s) to be used for the estimation
of the signal level.
a positive integer defining the minimum number
of non-missing observations within each window (half) which is required
for a ‘sensible’ estimation. Default: if a window (half) contains
a logical indicating whether the level
estimations should be extrapolated to the edges of the time series.
The extrapolation extends the first estimated value to the first
time in the first window and the last estimated value to
the last time in the last time window. Default is
hybrid.filter is suitable for extracting low frequency
components (the signal) from a time series which may be
contaminated with outliers and can contain level shifts or local
extremes. For this, moving window techniques are applied.
Within each time window several subfilters are applied to half-windows (left and right of the centre); the final signal level in the centre of the time window is then estimated by the median of the subfilter outputs.
For the subfilters, both, location-based and regression-based method are available, the former applying means or medians and the idea of a locally constant signal value, the latter using ordinary least squares (LS) regression or Siegel's (1982) repeated median (RM) and the idea of an underlying locally linear trend.
The methods should be chosen based on an a-priori guess of the
underlying signal and the data quality. Location based methods
recommended in case of a locally (piecewise) constant signal.
Regression based and predictive approaches (
PRMMH) in case of locally linear
monotone trends. The combined filters (
CRMMH) can be seen as a compromise, but are
computationally somewhat more expensive and may be inferior to
the predictive filters during steep trends.
The approaches based on the median and RM are robust alternatives
to the (in Gaussian samples) more efficient mean and least
squares methods. The hybrid filters preserve shifts and local
extremes much better than
for the price of decreased robustness and / or Gaussian
hybrid.filter returns an object of class
An object of class
hybrid.filter is a list containing the
a data frame containing the signal level extracted
by the filter(s) specified in
a data frame (possibly) containing
In addition, the original input time series is returned as list
y, and the settings used for the analysis are
returned as the list members
Application of the function
plot to an object of class
hybrid.filter returns a plot showing the original time series
with the filtered output.
The following methods are available as
method for signal extraction.
Filters applying only one location or regression estimate
to the whole window of length
width and taking the
location (in the centre of the time window) as final signal level
ordinary running median filter.
ordinary moving average filter.
ordinary repeated median filter.
Applies repeated median regression to each time window.
Filters applying several subfilters within one window, taking the median of the values listed below as the final signal level estimate:
FIR median hybrid filter.
Uses half-window averages and the central observation.
Uses half-window least squares regression and the central observation.
Uses half-window averages, half-window least squares regression, and the central observation.
median hybrid filter.
Uses half-window medians and the central observation.
predictive repeated median hybrid filter.
Uses half-window repeated median regression and the central observation.
combined repeated median hybrid filter.
Uses half-window medians, half-window repeated median regression, and the central observation.
median/median hybrid filter.
Uses half-window medians and the median of all observations in the window.
predictive repeated median/median filter.
Uses half-window repeated median regression and the median of all observations in the window.
combined repeated median/median filter.
Uses half-window medians, half-window repeated median regression, and the median of all observations in the window.
Missing values are treated by omitting them and thus by
reducing the corresponding window width.
hybrid.filter function only offers filters for signal
extraction delayed by (
width+1)/2 time units, in contrast
to other filters available from the
which also offer online time series analysis without time delay.
Roland Fried and Karen Schettlinger
Fried, R., Bernholt, T., Gather, U. (2006)
Repeated Median and Hybrid Filters, Computational Statistics \& Data Analysis 50,
(earlier version: http://www.sfb475.uni-dortmund.de/berichte/tr10-04.ps)
Schettlinger, K., Fried, R., Gather, U. (2006) Robust Filters for Intensive Care Monitoring: Beyond the Running Median, Biomedizinische Technik 51(2), 49-56.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# Generate random time series: y <- cumsum(runif(500)) - .5*(1:500) # Add jumps: y[200:500] <- y[200:500] + 5 y[400:500] <- y[400:500] - 7 # Add noise: n <- sample(1:500, 30) y[n] <- y[n] + rnorm(30) # Filtering with all methods: y.hy <- hybrid.filter(y, width=31) # Plot: plot(y.hy) # Filtering with running median and PRMH only: y2.hy <- hybrid.filter(y, width=31, method=c("MED","PRMH")) plot(y2.hy)
Loading required package: robustbase Loading required package: MASS Loading required package: lattice
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.