scarm.filter: SCARM (Slope Comparing Adaptive Repeated Median)

View source: R/scarm.filter.R

scarm.filterR Documentation

SCARM (Slope Comparing Adaptive Repeated Median)

Description

A procedure for robust online signal extraction from univariate time series ("smoothing") by a moving window technique with adaptive window width selection based on Repeated Median regression

Usage

scarm.filter(time.series,
             right.width=30, min.left.width=right.width,
             min.width=floor(right.width/3), max.width=200,
             sign.level=0.001, bound.noise.sd=0.01, rtr=TRUE,
             autocorrelations="automatic")

Arguments

time.series

a numeric vector or (univariate) time series object.

right.width

a positive integer >=5 defining the fixed width of the right-hand window used for testing; the choice of right.width is crucial to distinguish between a patch of outliers and a signal change.

min.left.width

a positive integer \ge right.width defining the minimum width of the left-hand window used for testing.

min.width

a positive integer \ge 5 specifying the minimum window width.

max.width

a positive integer \ge min.width and \ge right.width + min.left.width specifying the maximum window width.

sign.level

significance level of the test procedure; must be a value in (0,0.5).

bound.noise.sd

a lower bound for the estimate of the noise standard deviation; this bound ensures that the noise scale estimate cannot be zero due to ties in the data; must be a value > 0.

rtr

if rtr=TRUE, the signal estimation is restricted to the range of the rightmost min.width observations.

autocorrelations

the scarm.filter is developed for non-autocorrelated data, but can be adapted to work for AR(1) processes with parameter \phi = -0.9,-0.6,...,0.9; autocorrelations must be either "no" (\phi=0), "high.positive" (\phi=0.9), "moderate.positive" (\phi=0.6), "small.positive" (\phi=0.3), "small.negative" (\phi=-0.3), "moderate.negative (\phi=-0.6)", "high.negative (\phi=-0.9)" or "automatic"; if autocorrelations="automatic", the true parameter \phi is estimated at each time point.

Details

The scarm.filter fits a Repeated Median (RM, Siegel, 1982) regression line to a moving window sample with length varying between min.width and max.width.

For each time point, the window width is adapted to the current data situation by a test comparing two RM slopes estimated in separated sub-windows, a right-hand and a left-hand window.

A more detailed description of the filter can be found in Borowski and Fried (2011).

Value

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

signal.est

a vector containing the signal estimations

slope.est

a vector containing the slope (or trend) estimations

adapted.width

a vector containing the adapted window widths

test.statistic

a vector containing the SCARM test statistics

critvals

a vector containing the critical values for test decision

noise.sd

a vector containing the estimates of the noise standard deviation

slope.diff

a vector containing the differences of the Repeated Median slopes estimated in the left-hand and right-hand window

acf.lag.one

a vector containing the estimated autocorrelations at lag one for each time point; estimation is done on the recent max.width observations at each time point

time.series

the original input data

In addition, the input arguments used for the analysis are returned as list members.

Application of the function plot to an object of class scarm.filter returns a plot showing the original time series with the filtered output. If info==TRUE (default), a plot of the adapted window widths is also given.

Author(s)

Matthias Borowski

References

Borowski, M. and Fried, R. (2011) Robust repeated median regression in moving windows with data-adaptive width selection, Discussion Paper 28/2011, SFB 823, TU Dortmund University.

Gelper, S., Schettlinger, K., Croux, C., and Gather, U. (2009) Robust online scale estimation in time series: A model-free approach, Journal of Statistical Planning and Inference, 139(2), 335-349.

Siegel, A.F. (1982) Robust Regression Using Repeated Medians, Biometrika 69(1), 242-244.

See Also

robreg.filter, adore.filter, madore.filter, mscarm.filter.

Examples

# Time series
data(multi.ts)
x <- multi.ts[,1]

# apply SCARM Filter 
scarm.extr <- scarm.filter(x)
plot(scarm.extr)

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