Turning Points of a Time Series
Extracts and analyzes turn points of an univariate
turnsStats(x, doplot = TRUE)
- an univariate 'timeSeries' object of financial indices or prices.
- optional arguments passed to the function
- a logical flag, should the results be plotted? By default TRUE.
turns determines the number and the position of
extrema (turning points, either peaks or pits) in a regular time series.
turnsStats calculates the quantity of information
associated to the observations in this series, according to Kendall's
The functions are borrowed from the contributed R package
and made ready for working together with univariate
objects. You need not to load the R package
pastecs, the code parts
we need here are builtin in the
We have renamed the function
distinguish between the original function in the contributed R package
pastecs and our Rmetrics function wrapper.
For further details please consult the help page from the contributed R
turnsreturns an object of class
turnsStatsreturns an object of class
turnpointswith the following entries:
data- The dataset to which the calculation is done.
n- The number of observations.
points- The value of the points in the series, after elimination of ex-aequos.
pos- The position of the points on the time scale in the series (including ex-aequos).
exaequos- Location of exaequos (1), or not (0).
nturns- Total number of tunring points in the whole time series.
firstispeak- Is the first turning point a peak (TRUE), or not (FALSE).
peaks- Logical vector. Location of the peaks in the time series without ex-aequos.
pits- Logical vector. Location of the pits in the time series without ex-aequos.
tppos- Position of the turning points in the initial series (with ex-aequos).
proba- Probability to find a turning point at this location.
info- Quantity of information associated with this point.
Ibanez, F., 1982, Sur une nouvelle application de la theorie de l'information a la description des series chronologiques planctoniques. J. Exp. Mar. Biol. Ecol., 4, 619--632
Kendall, M.G., 1976, Time Series, 2nd ed. Charles Griffin and Co, London.
## Load Swiss Equities Series - SPI.RET <- LPP2005REC[, "SPI"] head(SPI.RET) ## Cumulate and Smooth the Series - SPI <- smoothLowess(cumulated(SPI.RET), f=0.05) plot(SPI) ## Plot Turn Points Series - SPI.SMOOTH <- SPI[, 2] tP <- turns(SPI.SMOOTH) plot(tP) ## Compute Statistics - turnsStats(SPI.SMOOTH)