Next: ECGEVAL(1) Up: WFDB Applications Guide Previous: COHERENCE(1)On This Page


dfa - detrended fluctuation analysis


dfa [ option ... ]


The method of detrended fluctuation analysis (DFA) has proven useful in revealing the extent of long-range correlations in seemingly irregular time series.

Briefly, the time series to be analyzed is first integrated. Next, the integrated time series is divided into boxes of equal length, n. In each box of length n, a least squares line (or polynomial curve of order k) is fit to the data (representing the trend in that box). Next, we detrend the integrated time series by subtracting the local trend in each box. The root-mean-square fluctuation of this integrated and detrended time series is calculated and denoted as F(n) .

This computation is repeated over all time scales (box sizes), from n = minbox to n = maxbox, to characterize the relationship between F(n) , the average fluctuation, and n, the box size. Typically, F(n) will increase with box size n. A linear relationship on a log-log plot indicates the presence of power law (fractal) scaling. Under such conditions, the fluctuations can be characterized by a scaling exponent, i.e., the slope of the line relating log[F(n) ] to log[n].

This program performs detrended fluctuation analysis on a sequence of data read from the standard input (which should contain a single column of numbers in text format). The standard output contains two columns of numbers, which are the base 10 logarithms of n and F(n) . Note that dfa does not compute a scaling exponent; to do so, fit the output to a line and measure its slope.

Options may include:

-d k
Detrend the data using a polynomial of degree k (1: linear, 2: quadratic, etc.). Default: k = 1 (linear detrending).
Print a usage summary and exit.
Do not integrate the input series. Use this option if the input series is already integrated (for example, if it represents times of occurrence rather than intervals).
-l minbox
Set the smallest box width. The default, and the minimum allowed value for minbox, is 2k + 2 (where k is determined by the -d option, see above).
Perform a sliding window DFA (measure the fluctuations using all possible boxes at each box size). By default, fluctuations are measured using non-overlapping boxes only. Using the -s option will make the calculation much slower.
-u maxbox
Set the largest box width. The default, and the maximum allowed value for maxbox, is one-fourth the length of the input series.

See Also

The DFA method was first proposed in Peng C-K, Buldyrev SV, Havlin S, Simons M, Stanley HE, Goldberger AL. Mosaic organization of DNA nucleotides. Phys Rev E 1994;49:1685-1689.

A detailed description of the algorithm and its application to physiologic signals can be found in Peng C-K, Havlin S, Stanley HE, Goldberger AL. Quantification of scaling exponents and crossover phenomena in nonstationary heartbeat time series. Chaos 1995;5:82-87.


dfa is available as part of PhysioToolkit under the GPL (see SOURCE below).


JE Mietus (, C-K Peng, and GB Moody, based on C-K Peng’s original Fortran implementation.


Table of Contents

Up: WFDB Applications Guide

Please e-mail your comments and suggestions to, or post them to:

MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 28 May 2015