# Detrended fluctuation analysis

In stochastic processes, chaos theory and time series analysis, detrended fluctuation analysis (DFA) is a method for determining the statistical self-affinity of a signal. It is useful for analysing time series that appear to be long-memory processes (diverging correlation time, e.g. power-law decaying autocorrelation function) or 1/f noise.

The obtained exponent is similar to the Hurst exponent, except that DFA may also be applied to signals whose underlying statistics (such as mean and variance) or dynamics are non-stationary (changing with time). It is related to measures based upon spectral techniques such as autocorrelation and Fourier transform.

Peng et al. introduced DFA in 1994 in a paper that has been cited over 2000 times as of 2013[1] and represents an extension of the (ordinary) fluctuation analysis (FA), which is affected by non-stationarities.

## Calculation

Given a bounded time series ${\displaystyle x_{t}}$, ${\displaystyle t\in \mathbb {N} }$, integration or summation first converts this into an unbounded process ${\displaystyle X_{t}}$:

${\displaystyle X_{t}=\sum _{i=1}^{t}(x_{i}-\langle x\rangle )}$

${\displaystyle X_{t}}$ is called cumulative sum or profile. This process converts, for example, an i.i.d. white noise process into a random walk.

Next, ${\displaystyle X_{t}}$ is divided into time windows ${\displaystyle Y_{j}}$ of length ${\displaystyle n}$ samples, and a local least squares straight-line fit (the local trend) is calculated by minimising the squared error ${\displaystyle E^{2}}$ with respect to the slope and intercept parameters ${\displaystyle a,b}$:

${\displaystyle E^{2}=\sum _{j=1}^{L}\left(Y_{j}-ja-b\right)^{2}.}$

Trends of higher order can be removed by higher order DFA, where the linear function ${\displaystyle ja+b}$ is replaced by a polynomial of order ${\displaystyle i}$.[2] Next, the root-mean-square deviation from the trend, the fluctuation, is calculated over every window at every time scale:

${\displaystyle F(n)=\left[{\frac {1}{N}}\sum _{j=1}^{N}\left(Y_{j}-ja-b\right)^{2}\right]^{\frac {1}{2}}.}$

where N = the number of windows of size n per scale. This detrending followed by fluctuation measurement process is repeated over the whole signal at a range of different window sizes ${\displaystyle n}$, and a log-log graph of ${\displaystyle n}$ against ${\displaystyle F(n)}$ is constructed.

A straight line on this log-log graph indicates statistical self-affinity expressed as ${\displaystyle F(n)\propto n^{\alpha }}$. The scaling exponent ${\displaystyle \alpha }$ is calculated as the slope of a straight line fit to the log-log graph of ${\displaystyle n}$ against ${\displaystyle F(n)}$ using least-squares. This exponent is a generalization of the Hurst exponent. Because the expected displacement in an uncorrelated random walk of length N grows like ${\displaystyle {\sqrt {N}}}$, an exponent of ${\displaystyle {\tfrac {1}{2}}}$ would correspond to uncorrelated white noise. When the exponent is between 0 and 1, the result is Fractional Brownian motion, with the precise value giving information about the series self-correlations:

• ${\displaystyle \alpha <1/2}$: anti-correlated
• ${\displaystyle \alpha \simeq 1/2}$: uncorrelated, white noise
• ${\displaystyle \alpha >1/2}$: correlated
• ${\displaystyle \alpha \simeq 1}$: 1/f-noise, pink noise
• ${\displaystyle \alpha >1}$: non-stationary, unbounded
• ${\displaystyle \alpha \simeq 3/2}$: Brownian noise

There are different orders of DFA. In the described case, linear fits (${\displaystyle i=1}$) are applied to the profile, thus it is called DFA1. In general, DFA${\displaystyle n}$, uses polynomial fits of order ${\displaystyle i}$. Due to the summation (integration) from ${\displaystyle x_{i}}$ to ${\displaystyle X_{t}}$, linear trends in the mean of the profile represent constant trends in the initial sequence, and DFA1 only removes such constant trends (steps) in the ${\displaystyle x_{i}}$. In general DFA of order ${\displaystyle i}$ removes (polynomial) trends of order ${\displaystyle i-1}$. For linear trends in the mean of ${\displaystyle x_{i}}$ at least DFA2 is needed. The Hurst R/S analysis removes constants trends in the original sequence and thus, in its detrending it is equivalent to DFA1. The DFA method was applied to many systems; e.g., DNA sequences,[3][4] neuronal oscillations,[5] speech pathology detection,[6] and heartbeat fluctuation in different sleep stages.[7] Effect of trends on DFA were studied in[8] and relation to the power spectrum method is presented in.[9]

Since in the fluctuation function ${\displaystyle F(n)}$ the square(root) is used, DFA measures the scaling-behavior of the second moment-fluctuations, this means ${\displaystyle \alpha =\alpha (2)}$. The multifractal generalization (MF-DFA)[10] uses a variable moment ${\displaystyle q}$ and provides ${\displaystyle \alpha (q)}$. Kantelhardt et al. intended this scaling exponent as a generalization of the classical Hurst exponent. The classical Hurst exponent corresponds to the second moment for stationary cases ${\displaystyle H=\alpha (2)}$ and to the second moment minus 1 for nonstationary cases ${\displaystyle H=\alpha (2)-1}$.[5][10]

## Relations to other methods

In the case of power-law decaying auto-correlations, the correlation function decays with an exponent ${\displaystyle \gamma }$: ${\displaystyle C(L)\sim L^{-\gamma }\!\ }$. In addition the power spectrum decays as ${\displaystyle P(f)\sim f^{-\beta }\!\ }$. The three exponent are related by:[3]

• ${\displaystyle \gamma =2-2\alpha }$
• ${\displaystyle \beta =2\alpha -1}$ and
• ${\displaystyle \gamma =1-\beta }$.

The relations can be derived using the Wiener–Khinchin theorem.

Thus, ${\displaystyle \alpha }$ is tied to the slope of the power spectrum ${\displaystyle \beta }$ and is used to describe the color of noise by this relationship: ${\displaystyle \alpha =(\beta +1)/2}$.

For fractional Gaussian noise (FGN), we have ${\displaystyle \beta \in [-1,1]}$, and thus ${\displaystyle \alpha =[0,1]}$, and ${\displaystyle \beta =2H-1}$, where ${\displaystyle H}$ is the Hurst exponent. ${\displaystyle \alpha }$ for FGN is equal to ${\displaystyle H}$.

For fractional Brownian motion (FBM), we have ${\displaystyle \beta \in [1,3]}$, and thus ${\displaystyle \alpha =[1,2]}$, and ${\displaystyle \beta =2H+1}$, where ${\displaystyle H}$ is the Hurst exponent. ${\displaystyle \alpha }$ for FBM is equal to ${\displaystyle H+1}$. In this context, FBM is the cumulative sum or the integral of FGN, thus, the exponents of their power spectra differ by 2.

## Pitfalls in interpretation

As with most methods that depend upon line fitting, it is always possible to find a number ${\displaystyle \alpha }$ by the DFA method, but this does not necessarily imply that the time series is self-similar. Self-similarity requires that the points on the log-log graph are sufficiently collinear across a very wide range of window sizes ${\displaystyle L}$.

Also, there are many scaling exponent-like quantities that can be measured for a self-similar time series, including the divider dimension and Hurst exponent. Therefore, the DFA scaling exponent ${\displaystyle \alpha }$ is not a fractal dimension sharing all the desirable properties of the Hausdorff dimension, for example, although in certain special cases it can be shown to be related to the box-counting dimension for the graph of a time series.