Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

decmedian

Time series decomposition using a running median


Description

This is a nonlinear filtering method used to smooth, but also to segment a time series. The isolated peaks and pits are leveraged by this method.

Usage

decmedian(x, type="additive", order=1, times=1, ends="fill")

Arguments

x

a regular time series ('rts' under S+ and 'ts' under R)

type

the type of model, either type="additive" (by default), or type="multiplicative"

order

the window used for the running median corresponds to 2*order + 1

times

the number of times the running median is applied. By default, 1

ends

the method used to calculate ends. Either "NAs" (fill extremes, non-calculable values with NAs), or "fill" (fill these extremes with the closest calculable median)

Value

a 'tsd' object

Author(s)

Frédéric Ibanez (ibanez@obs-vlfr.fr), Philippe Grosjean (phgrosjean@sciviews.org)

References

Gebski, V.J., 1985. Some properties of splicing when applied to non-linear smoothers. Comp. Stat. Data Anal., 3:151-157.

Philips, L. & R. Blomme, 1973. Analyse chronologique. Université Catholique de Louvain. Vander ed. 339 pp.

Tukey, J.W., 1977. Exploratory Data Analysis. Reading Massachusetts: Addison-Wesley.

See Also

Examples

data(marbio)
ClausoB.ts <- ts(log(marbio$ClausocalanusB + 1))
ClausoB.dec <- decmedian(ClausoB.ts, order=2, times=10, ends="fill")
plot(ClausoB.dec, col=c(1, 4, 2), xlab="stations")
# This is a transect across a frontal zone:
plot(ClausoB.dec, col=c(0, 2), xlab="stations", stack=FALSE, resid=FALSE)
lines(c(17, 17), c(0, 10), col=4, lty=2)
lines(c(25, 25), c(0, 10), col=4, lty=2)
lines(c(30, 30), c(0, 10), col=4, lty=2)
lines(c(41, 41), c(0, 10), col=4, lty=2)
lines(c(46, 46), c(0, 10), col=4, lty=2)
text(c(8.5, 21, 27.5, 35, 43.5, 57), 8.7, labels=c("Peripheral Zone", "D1",
        "C", "Front", "D2", "Central Zone"))

pastecs

Package for Analysis of Space-Time Ecological Series

v1.3.21
GPL-2
Authors
Philippe Grosjean [aut, cre], Frederic Ibanez [aut], Michele Etienne [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.