decdiff: Time series decomposition using differences (trend...

decdiffR Documentation

Time series decomposition using differences (trend elimination)

Description

A filtering using X(t+lag) - X(t) has the property to eliminate the general trend from the series, whatever its shape

Usage

decdiff(x, type="additive", lag=1, order=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"

lag

The lag between the two observations used to calculate differences. By default, lag=1

order

The order of the difference corresponds to the number of times it is applied, by default order=1

ends

either "NAs" (fill first values that are not calculable with NAs), or "fill" (fill them with the average of following observations before applying the filter, by default), or "drop" (do not fill them). If ends="drop", the filtered series will be shorter than the initial one by lag*order. In all other cases, the filtered series is as large as the initial one

Details

This function is a wrapper around the diff() function to create a 'tsd' object. It also manages initial values through the ends argument.

Value

a 'tsd' object

Author(s)

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

References

Kendall, M., 1976. Time-series. Charles Griffin & Co Ltd. 197 pp.

Laloire, J.C., 1972. Méthodes du traitement des chroniques. Dunod, Paris, 194 pp.

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

See Also

tsd, tseries, decaverage, deccensus, decmedian, decevf, decreg, decloess

Examples

data(marbio)
ClausoB.ts <- ts(log(marbio$ClausocalanusB + 1))
ClausoB.dec <- decdiff(ClausoB.ts, lag=1, order=2, ends="fill")
plot(ClausoB.dec, col=c(1, 4, 2), xlab="stations")

pastecs documentation built on May 29, 2024, 5:56 a.m.