local.trend: Calculate local trends using cumsum
Description
A simple method using cumulated sums that allows to detect changes in the tendency in a time seriesUsage
local.trend(x, k=mean(x), plotit=TRUE, ...)
identify.local.trend(loctrd)
Arguments
x
a regular time series (a 'rts' object under S+ or a 'ts' object under R)
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
...
additional arguments for the graph
loctrd
a 'local.trend' object, as returned by the function local.trend()
Value
- a 'local.trend' object is returned. It has the method
identify()
synopsis
local.trend(x, k=mean(x), plotit=TRUE, type="l", cols=1:2, ltys=2:1, xlab="Time", ylab="cusum", ...)
identify.local.trend(x, ...)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 intervalsReferences
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.Examples
Run this codedata(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...
Run the code above in your browser using DataLab