Fractal class

class pyActigraphy.analysis.Fractal(n_array=None, q_array=None)[source]

Class for Fractality Analysis

This class implements methods used to perform a (multifractal) detrended fluctuation analysis, (MF)DFA.

The implementation follows the original description made in [1] and [2].

The (MF)DFA consists in:

  1. removing the global mean and integrating the time series of a signal:

    \[X_{t} = \sum_i^N(x_i - \bar{x})\]

    where \(\bar{x}\) denotes the mean value of the time series \(\{x_i\}_{i\in[1:N]}\);

  2. dividing the integrated signal into N non-overlapping windows of the same chosen size n;

  3. detrending the integrated signal in each window using polynomial functions to obtain residuals, that is:

    \[\widehat{X_t} = X_{t} - Y_{t}\]

    where \(Y_t\) denotes the trend obtained by polynomial fit and \(\widehat{X_t}\) the integrated time series after detrending;

  4. calculating the root mean square of residuals in all windows as detrended fluctuation amplitude \(F_q(n)\), that is:

    \[F_q(n) = \left[\frac{1}{N} \sum_{t=1}^N \widehat{X_t}^q\right]^{1/q}\]

For \(q=2\), the DFA is retrieved.

In the context of actigraphy, further informations can be found in:

  • Hu, K., Ivanov, P. C., Chen, Z., Hilton, M. F., Stanley, H. E., & Shea, S. A. (2004). Non-random fluctuations and multi-scale dynamics regulation of human activity. Physica A: Statistical Mechanics and Its Applications, 337(1–2), 307–318. https://doi.org/10.1016/j.physa.2004.01.042

References

1

Peng, C.-K., Buldyrev, S. V., Havlin, S., Simons, M., Stanley, H. E., & Goldberger, A. L. (1994). Mosaic organization of DNA nucleotides. Physical Review E, 49(2), 1685–1689. https://doi.org/10.1103/PhysRevE.49.1685

2

Kantelhardt, J. W., Zschiegner, S. A., Koscielny-Bunde, E., Havlin, S., Bunde, A., & Stanley, H. E. (2002). Multifractal detrended fluctuation analysis of nonstationary time series. Physica A: Statistical Mechanics and Its Applications, 316(1–4), 87–114. https://doi.org/10.1016/S0378-4371(02)01383-3

Methods

profile(X)

Profile function

segmentation(x, n[, backward, overlap])

Segmentation function

local_msq_residuals(segment, deg)

Mean squared residuals

fluctuations(X, n, deg[, overlap])

Fluctuation function

dfa(ts, n_array[, deg, overlap, log])

Detrended Fluctuation Analysis function

dfa_parallel(ts, n_array[, deg, overlap, ...])

Detrended Fluctuation Analysis function

mfdfa(ts, n_array, q_array[, deg, overlap, log])

Multifractal Detrended Fluctuation Analysis function

mfdfa_parallel(ts, n_array, q_array[, deg, ...])

Multifractal Detrended Fluctuation Analysis function

generalized_hurst_exponent(F_n, n_array[, ...])

Generalized Hurst exponent

crossover_search(F_n, n_array[, n_min, log])

Search for crossovers