local.trend: Calculate local trends using cumsum

local.trendR Documentation

Calculate local trends using cumsum

Description

A simple method using cumulated sums that allows to detect changes in the tendency in a time series

Usage

local.trend(x, k=mean(x), plotit=TRUE, type="l", cols=1:2, ltys=2:1,
    xlab="Time", ylab="cusum", ...)
## S3 method for class 'local.trend'
identify(x, ...)

Arguments

x

a regular time series (a 'ts' object) for local.trend() or a 'local.trend' object for identify()

k

the reference value to substract from cumulated sums. By default, it is the mean of all observations in the series

plotit

if plotit=TRUE (by default), a graph with the cumsum curve superposed to the original series is plotted

type

the type of plot (as usual notation for this argument)

cols

colors to use for original data and for the trend line

ltys

line types to use for original data and the trend line

xlab

label of the x-axis

ylab

label of the y-axis

...

additional arguments for the graph

Details

With local.trend(), you can:

- detect changes in the mean value of a time series

- determine the date of occurence of such changes

- estimate the mean values on homogeneous intervals

Value

a 'local.trend' object is returned. It has the method identify()

Note

Once transitions are identified with this method, you can use stat.slide() to get more detailed information on each phase. A smoothing of the series using running medians (see decmedian()) allows also to detect various levels in a time series, but according to the median statistic. Under R, see also the 'strucchange' package for a more complete, but more complex, implementation of cumsum applied to time series.

Author(s)

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

References

Ibanez, F., J.M. Fromentin & J. Castel, 1993. Application de la méthode des sommes cumulées à l'analyse des séries chronologiques océanographiques. C. R. Acad. Sci. Paris, Life Sciences, 316:745-748.

See Also

trend.test, stat.slide, decmedian

Examples

data(bnr)
# Calculate and plot cumsum for the 8th series
bnr8.lt <- local.trend(bnr[,8])
# To identify local trends, use:
# identify(bnr8.lt)
# and click points between which you want to compute local linear trends...

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