DFA: Detrended fluctuation analysis

Description Usage Arguments Details Value References See Also Examples


Performs a detrended fluctuation analysis (DFA) and estimates the scaling exponent from the results. DFA is used to characterize long memory dependence in stochastic fractal time series.


DFA(x, detrend="poly1", sum.order=0, overlap=0,
    scale.max=trunc(length(x)/2), scale.min=NULL,
    scale.ratio=2, verbose=FALSE)



a vector containing a uniformly-sampled real-valued time series.


a character string denoting the type of detrending to use on each block of the time series. Supported types are:


specifies a polynomial fit where K is an integer denoting the order of the polynomial. For example, if detrend="poly2", a second order polynomial of the form x(t)=b0 + b1*t + b2*t^2 will be used to fit the data in each block using least squares. The polynomial order must be positive or zero.


specifies bridge detrending. A line connecting the endpoints of each block is subtracted.


instructs the function to not detrend the data.

Default: "poly1".


the overlap of blocks in partitioning the time data expressed as a fraction in [ 0,1). A positive overlap will slow down the calculations slightly with the (possible) effect of generating less biased results. Default: 0.


an integer denoting the maximum block size to use in partitioning the data. Default: trunc(length(x)/2).


an integer denoting the minimum block size to use in partitioning the data. Default: for polynomial detrending the default value is 2*(K+1). For all other detrending techniques, the default value is 4 or length(x)/4, whichever is smaller.


the ratio of successive scales. This argument is used as an input to the logScale function. Default: 2.


an integer denoting the number of differences or cumulative summations to perform on the original data before performing a DFA. Differences are specified by negative integers and cumulative summations by positive integers. For example, to perform a second order difference, set sum.order=-2. Default: 0.


a logical value. If TRUE, the detrending model and processing progress information is displayed. Default: FALSE.


The DFA algorithm is implemented as follows:


DFA is useful for characterizing long-memory correlations in stochastic fractal time series, i.e. sequences whose spectral density function S(f) obeys a power law S~|f|^alpha at low frequencies where 0 <= f <= 1/2 is the normalized frequency variable and alpha <= -1 is the long memory (scaling) exponent. If the scaling exponent for an original time series is alpha > -1, then (possibly multiple) cumulative summations of the original time series must be performed to increase the scaling exponent (each cumulative summation decreases the exponent by 2). For example, a (single) cumulative summation must be performed on a white noise realization since its scaling exponent is zero. We also provide the user with the ability to perform (consecutive) first order differencing operations on the original time series prior to a DFA. Each differencing operation raises the scaling exponent by 2. Differencing a series is acceptable prior to DFA as long as the resulting scaling exponent is less than -1.


The series resulting from stage one is uniformly partitioned into blocks of a specified minimum size (scale.min), and each block is (optionally) detrended. The variance of the detrended sequence in each block is calculated and the collection of variances is averaged to form the scalar value F^2(scale.min) which summarizes the variability of the sequence at the current scale.


Stage two is repeated using successively larger blocks until the largest scale (scale.max) has been reached.


For long-memory processes, we expect to find a linear relation between log F(scale) and log scale. The slope of the line which best fits a plot of log F(scale) versus log scale is defined as the scaling exponent.


an object of class fractalBlock.


Peng C-K, Buldyrev SV, Havlin S, Simons M, Stanley HE, and Goldberger AL (1994), Mosaic organization of DNA nucleotides, Physical Review E, 49, 1685–1689.

Peng C-K, Havlin S, Stanley HE, and Goldberger AL (1995), Quantification of scaling exponents and crossover phenomena in nonstationary heartbeat time series, Chaos, 5, 82–87.

Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, Mietus JE, Moody GB, Peng C-K, Stanley HE (2000, June 13), PhysioBank, PhysioToolkit, and Physionet: Components of a New Research Resource for Complex Physiologic Signals, Circulation, 101(23), e215-e220.

See Also

logScale, fractalBlock.


## calculate the scaling exponent for a random 
## walk realization 
DFA.walk <- DFA(rnorm(1024), detrend="poly1", sum.order=1)

## print the results 

## plot a summary of the results 

fractal documentation built on May 20, 2017, 3:09 a.m.

Search within the fractal package
Search all R packages, documentation and source code