# 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 3,000 times as of 2022 and represents an extension of the (ordinary) fluctuation analysis (FA), which is affected by non-stationarities.

## Calculation

Consider a bounded time series $x_{t}$ of length $N$ , where $t\in \mathbb {N}$ , and let its mean value be denoted $\langle x\rangle$ . Integration or summation converts this into an unbounded process $X_{t}$ :

$X_{t}=\sum _{i=1}^{t}(x_{i}-\langle x\rangle )$ $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, $X_{t}$ is divided into time windows of length $n$ samples each, and a local least squares straight-line fit (the local trend) is calculated by minimising the squared errors within each time window. Let $Y_{t}$ indicate the resulting piecewise sequence of straight-line fits. Then, the root-mean-square deviation from the trend, the fluctuation, is calculated:

$F(n)={\sqrt {{\frac {1}{N}}\sum _{t=1}^{N}\left(X_{t}-Y_{t}\right)^{2}}}.$ Finally, this process of detrending followed by fluctuation measurement is repeated over a range of different window sizes $n$ , and a log-log graph of $F(n)$ against $n$ is constructed.

A straight line on this log-log graph indicates statistical self-affinity expressed as $F(n)\propto n^{\alpha }$ . The scaling exponent $\alpha$ is calculated as the slope of a straight line fit to the log-log graph of $n$ against $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 ${\sqrt {N}}$ , an exponent of ${\tfrac {1}{2}}$ would correspond to uncorrelated white noise. When the exponent is between 0 and 1, the result is fractional Gaussian noise, with the precise value giving information about the series self-correlations:

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

### Generalization to supralinear trends

Trends of higher order can be removed by higher order DFA, in which a linear fit is replaced by a polynomial fit. In the described case, linear fits ($i=1$ ) are applied to the profile, thus it is called DFA1. To remove trends of higher order, DFA$i$ , uses polynomial fits of order $i$ .

Owing to the summation (integration) from $x_{i}$ to $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 $x_{i}$ . In general, DFA of order $i$ removes (polynomial) trends of order $i-1$ . For linear trends in the mean of $x_{i}$ at least DFA2 is needed.

The Hurst R/S analysis removes constant trends in the original sequence and thus, in its detrending it is equivalent to DFA1.

### Generalization to different moments

Since in the fluctuation function $F(n)$ the square (root) is used, DFA measures the scaling-behavior of the second moment-fluctuations, this means $\alpha =\alpha (2)$ . The multifractal generalization (MF-DFA) uses a variable moment $q$ and provides $\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 $H=\alpha (2)$ and to the second moment minus 1 for nonstationary cases $H=\alpha (2)-1$ .

Essentially, the scaling exponents need not be independent of the scale of the system. In the case $\alpha$ depends on the power $q$ extracted from

$F_{q}(n)=\left({\frac {1}{N}}\sum _{t=1}^{N}\left(X_{t}-Y_{t}\right)^{q}\right)^{1/q},$ where the previous DFA is $q=2$ . Multifractal systems scale as a function $F_{q}(n)\propto n^{\alpha (q)}$ . To uncover multifractality, Multifractal Detrended Fluctuation Analysis is one possible method.

## Applications and study

The DFA method has been applied to many systems, e.g. DNA sequences, neuronal oscillations, speech pathology detection, heartbeat fluctuation in different sleep stages, and animal behavior pattern analysis.

The effect of trends on DFA has been studied.

## Relations to other methods, for specific types of signal

### For signals with power-law-decaying autocorrelation

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

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

The relations can be derived using the Wiener–Khinchin theorem. The relation of DFA to the power spectrum method has been well studied.

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

### For fractional Gaussian noise

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

### For fractional Brownian motion

For fractional Brownian motion (FBM), we have $\beta \in [1,3]$ , and thus $\alpha \in [1,2]$ , and $\beta =2H+1$ , where $H$ is the Hurst exponent. $\alpha$ for FBM is equal to $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 $\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 $L$ . Furthermore, a combination of techniques including MLE, rather than least-squares has been shown to better approximate the scaling, or power-law, exponent.

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 $\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.