CalculateDFA: Detrended Fluctuation Analysis

View source: R/dfa.R

CalculateDFAR Documentation

Detrended Fluctuation Analysis

Description

Performs Detrended Fluctuation Analysis (DFA) on the RR time series, a widely used technique for detecting long range correlations in time series. These functions are able to estimate several scaling exponents from the time series being analyzed. These scaling exponents characterize short or long-term fluctuations, depending of the range used for regression (see details).

Usage

CalculateDFA(HRVData,
  indexNonLinearAnalysis = length(HRVData$NonLinearAnalysis),
  windowSizeRange = c(10, 300), npoints = 25, doPlot = TRUE)

EstimateDFA(HRVData,
  indexNonLinearAnalysis = length(HRVData$NonLinearAnalysis),
  regressionRange = NULL, doPlot = TRUE)

PlotDFA(HRVData, indexNonLinearAnalysis = length(HRVData$NonLinearAnalysis),
  ...)

Arguments

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

windowSizeRange

Range of values for the windows size that will be used to estimate the fluctuation function. Default: c(10,300).

npoints

The number of different window sizes that will be used to estimate the Fluctuation function in each zone.

doPlot

logical value. If TRUE (default value), a plot of the Fluctuation function is shown.

regressionRange

Vector with 2 components denoting the range where the function will perform linear regression

...

Additional plot parameters.

Details

The Detrended Fluctuation Analysis (DFA) has become a widely used technique for detecting long range correlations in time series. The DFA procedure may be summarized as follows:

  1. Integrate the time series to be analyzed. The time series resulting from the integration will be referred to as the profile.

  2. Divide the profile into N non-overlapping segments.

  3. Calculate the local trend for each of the segments using least-square regression. Compute the total error for each of the segments.

  4. Compute the average of the total error over all segments and take its root square. By repeating the previous steps for several segment sizes (let's denote it by t), we obtain the so-called Fluctuation function F(t).

  5. If the data presents long-range power law correlations: F(t) proportional t^alpha and we may estimate using regression.

  6. Usually, when plotting log(F(t)) Vs log(t) we may distinguish two linear regions. By regression them separately, we obtain two scaling exponents, alpha1 (characterizing short-term fluctuations) and alpha2 (characterizing long-term fluctuations).

Steps 1-4 are performed using the CalculateDFA function. In order to obtain a estimate of some scaling exponent, the user must use the EstimateDFA function specifying the regression range (window sizes used to detrend the series). alpha1 is usually obtained by performing the regression in the 3<t<17 range wheras that alpha2 is obtained in the 15<t<65 range (However the F(t) function must be linear in these ranges for obtaining reliable results).

Value

The CalculateDFA returns a HRVData structure containing the computations of the Fluctuation function of the RR time series under the NonLinearAnalysis list.

The EstimateDFA function estimates an scaling 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. In order to run EstimateDFA, it is necessary to have performed the Fluctuation function computations before with ComputeDFA. The results are returned into the HRVData structure, under the NonLinearAnalysis list. Since it is possible to estimate several scaling exponents, depending on the regression range used, the scaling exponents are also stored into a list.

PlotDFA shows a graphic of the Fluctuation functions vs window's sizes.

Note

This function is based on the dfa function from the nonlinearTseries package.

See Also

dfa


RHRV documentation built on Nov. 1, 2022, 1:05 a.m.