Functions for estimating the maximal Lyapunov exponent of the RR time series.
1 2 3 4 5 6 7 8 9 10 11 12  CalculateMaxLyapunov(HRVData,
indexNonLinearAnalysis = length(HRVData$NonLinearAnalysis),
minEmbeddingDim = NULL, maxEmbeddingDim = NULL, timeLag = NULL,
radius = 2, theilerWindow = 100, minNeighs = 5, minRefPoints = 500,
numberTimeSteps = 20, doPlot = TRUE)
EstimateMaxLyapunov(HRVData,
indexNonLinearAnalysis = length(HRVData$NonLinearAnalysis),
regressionRange = NULL, useEmbeddings = NULL, doPlot = TRUE)
PlotMaxLyapunov(HRVData,
indexNonLinearAnalysis = length(HRVData$NonLinearAnalysis), ...)

HRVData 
Data structure that stores the beats register and information related to it 
indexNonLinearAnalysis 
Reference to the data structure that will contain the nonlinear analysis 
minEmbeddingDim 
Integer denoting the minimum dimension in which we shall embed the time series 
maxEmbeddingDim 
Integer denoting the maximum dimension in which we shall embed the time series. Thus, we shall estimate the correlation dimension between minEmbeddingDim and maxEmbeddingDim. 
timeLag 
Integer denoting the number of time steps that will be use to construct the Takens' vectors. Default: timeLag = 1 
radius 
Maximum distance in which will look for nearby trajectories. Default: radius = 2 
theilerWindow 
Integer denoting the Theiler window: Two Takens' vectors must be separated by more than theilerWindow time steps in order to be considered neighbours. By using a Theiler window, temporally correlated vectors are excluded from the estimations. Default: theilerWindow = 100 
minNeighs 
Minimum number of neighbours that a Takens' vector must have to be considered a reference point. Default: minNeighs = 5 
minRefPoints 
Number of reference points that the routine will try to use. The routine stops when it finds minRefPoints reference points, saving computation time. Default: minRefPoints = 500 
numberTimeSteps 
Integer denoting the number of time steps in which the algorithm will compute the divergence. 
doPlot 
Logical value. If TRUE (default value), a plot of S(t) Vs t is shown. 
regressionRange 
Vector with 2 components denoting the range where the function will perform linear regression 
useEmbeddings 
A numeric vector specifying which embedding dimensions should the algorithm use to compute the maximal Lyapunov exponent. 
... 
Additional plot parameters. 
It is a wellknown fact that close trajectories diverge exponentially fast in a chaotic system. The averaged exponent that determines the divergence rate is called the Lyapunov exponent (usually denoted with lambda). If delta(0) is the distance between two Takens' vectors in the embedding.dimdimensional space, we expect that the distance after a time t between the two trajectories arising from this two vectors fulfills:
δ (n) is.approximately δ (0) exp(λ *t).
The lyapunov exponent is estimated using the slope obtained by performing a linear regression of S(t)=λ *t is.approximately log(δ (t)/δ (0)) on t. S(t) will be estimated by averaging the divergence of several reference points.
The user should plot S(t) Vs t when looking for the maximal lyapunov exponent and, if for some temporal range S(t) shows a linear behaviour, its slope is an estimate of the maximal Lyapunov exponent per unit of time. The estimate routine allows the user to get always an estimate of the maximal Lyapunov exponent, but the user must check that there is a linear region in the S(t) Vs t. If such a region does not exist, the estimation should be discarded. The user should also run the method for different embedding dimensions for checking if D1 saturates.
The CalculateMaxLyapunov returns a HRVData structure containing the divergence computations of the RR time series under the NonLinearAnalysis list.
The EstimateMaxLyapunov function estimates the maximum Lyapunov exponent of the RR time series by performing a linear regression over the time steps' range specified in regressionRange.If doPlot is TRUE, a graphic of the regression over the data is shown. The results are returned into the HRVData structure, under the NonLinearAnalysis list.
PlotMaxLyapunov shows a graphic of the divergence Vs time
This function is based on the maxLyapunov
function from the
nonlinearTseries package.
In order to run EstimateMaxLyapunov, it is necessary to have performed the divergence computations before with ComputeMaxLyapunov.
Eckmann, JeanPierre and Kamphorst, S Oliffson and Ruelle, David and Ciliberto, S and others. Liapunov exponents from time series. Physical Review A, 346, 4971–4979, (1986).
Rosenstein, Michael T and Collins, James J and De Luca, Carlo J.A practical method for calculating largest Lyapunov exponents from small data sets. Physica D: Nonlinear Phenomena, 651, 117–134, (1993).
1 2 3 4 5 6 7 8 9 10 11 12 13  ## Not run:
# ...
hrv.data = CreateNonLinearAnalysis(hrv.data)
hrv.data = CalculateMaxLyapunov(hrv.data,indexNonLinearAnalysis=1,
minEmbeddingDim=5,
maxEmbeddingDim = 5,
timeLag=1,radius=10,
theilerWindow=100, doPlot=FALSE)
PlotMaxLyapunov(hrv.data,indexNonLinearAnalysis=1)
hrv.data = EstimateMaxLyapunov(hrv.data,indexNonLinearAnalysis=1,
regressionRange=c(1,10))
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.