Detrended Fluctuation Analysis with continuous trend line.
Thesis: https://www.ap.uj.edu.pl/diplomas/133408/?_s=1
Detailed information on the algorithm can be found on Wikipedia (https://en.wikipedia.org/wiki/Detrended_fluctuation_analysis).
-
dfa_simple.py - a simple, basic implementation of the DFA method without the trend line continuity condition; the trend is represented as a quadratic function
-
continuous_trend.py - given segmented series as an input, it allows to calculate linear trends that are continuous in every "middle point" (uses quadratic programming)
-
dfa.py - DFA method implementation with the trend line continuity condition; it uses calculate_trend function defined in the continuous_trend.py file
Mathematics behind finding the DFA exponent for the continuous trend line
We are looking for the minimum of the given form:
with a continuity condition given by the following equation:
It comes down to solving the following set of equations: