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.

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).

-lminbox

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).

-s

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.

-umaxbox

Set the largest box width. The default, and the maximum allowed
value for maxbox, is one-fourth the length of the input series.

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.