pyhctsa.operations.scaling.mfdfa

pyhctsa.operations.scaling.mfdfa(y, scale_range=None, q_range=None, order=1)

Multifractal detrended fluctuation analysis (MFDFA): the multifractal spectrum of a time series.

Estimates the multifractal singularity spectrum f(alpha) of a time series by the classical MFDFA algorithm of Kantelhardt et al. (2002) [1]. The mean-subtracted series is integrated (cumulative sum) to a profile, which is divided into non-overlapping segments of length s (taken from both the start and the end of the series, to use the whole series when N is not a multiple of s). Each segment is detrended by a polynomial of a given order, and the q-th order fluctuation function F_q(s) is formed by averaging the segment variances raised to the power q/2 (with a log-averaging limit at q = 0). h(q), the slope of log F_q(s) against log s, is Legendre-transformed via the mass exponent tau(q) = q h(q) - 1 into the singularity spectrum f(alpha), where alpha = d tau / dq and f = q alpha - tau.

Unlike fluctuation_analysis (monofractal, q = 2) and mma (which reports how the raw h(q) surface varies with scale), this fixes the scaling range and focuses on the q axis.

References

Parameters:
y : array-like

The input time series.

scale_range : list, optional

[min_scale, max_scale], the range of segment lengths s used for the fluctuation-function fit, as 20 log-spaced values. Default is [16, floor(N/4)].

q_range : list, optional

[q_min, q_max], the range of the multifractal order q, sampled in steps of 0.5, with q = 0 handled by its log-averaging limit. Default is [-5, 5].

order : int, optional

The order of the polynomial used to detrend each segment (1 = linear detrending, MFDFA1). Default is 1.

Returns:

Dictionary containing:

  • meanR2: the mean (across q) of the R^2 of the log-log fits of F_q(s) against s.

  • h2: the generalized Hurst exponent h(q) at q = 2 (NaN if q = 2 is not in q_range).

  • alphaMin, alphaMax: the smallest and largest singularity exponents alpha.

  • alphaWidth: alphaMax - alphaMin, the degree of multifractality.

  • fAlphaMax: the maximum of f(alpha), the height of the spectrum’s peak.

  • alpha0: the alpha at the peak of the spectrum (the dominant exponent).

  • spectrumAsymmetry: (alpha0 - alphaMin) / (alphaMax - alpha0).

A scalar NaN is returned if the series or scale range cannot support the analysis.

Return type:

dict or float