Application Scenarios
The CFASeriesMFS class is used to calculate the multifractal spectrum of 1D time series, serving as an important tool for analyzing sequence complexity and long-range correlations. Main application scenarios include:
- Financial Time Series: Analyze multifractal properties of stock prices and returns
- Physiological Signal Analysis: Complexity analysis of ECG and EEG
- Climate Data: Multi-scale features of temperature and precipitation sequences
- Network Traffic: Self-similarity analysis of internet traffic
- Seismic Data: Multifractal features of seismic waveforms
Usage Examples
Basic Usage
Custom Scale Parameters
Installation
Class Description
CFASeriesMFS
Description: Class for calculating 1D time series multifractal spectrum based on MFDFA (Multifractal Detrended Fluctuation Analysis) method.
Initialization Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data | numpy.ndarray | Required | Input time series (1D array) |
q_list | array-like | linspace(-5,5,51) | q value list |
with_progress | bool | True | Whether to show progress bar |
Module-level Helper
recommended_lag(x_len, order=2, num_scales=40, s_min=None, s_max_ratio=0.25)
Description: Generate a recommended scale (lag) list for MFDFA.
Parameters:
x_len(int): Length of the input seriesorder(int): DFA polynomial ordernum_scales(int): Number of scale pointss_min(int or None): Minimum scale (auto if None)s_max_ratio(float): Maximum scale as fraction of series length (default 0.25)
Return Value: numpy array of integer lag values
Main Methods
1. get_mfs(lag_list=None, order=2)
Description: Calculate multifractal spectrum, including generalized Hurst exponent, mass exponent, singularity strength, and multifractal spectrum.
Parameters:
lag_list(array-like): Custom scale window list. If None, automatically generates recommended scales usingrecommended_lagorder(int): DFA polynomial fitting order, default is 2
Return Value (pandas.DataFrame):
| Column | Description |
|---|---|
q | q value |
h(q) | Generalized Hurst exponent |
t(q) | τ(q) mass exponent |
a(q) | α(q) singularity strength |
f(a) | f(α) multifractal spectrum |
d(q) | D(q) generalized dimension |
Example:
2. plot(df_mfs)
Description: Visualize multifractal spectrum analysis results with 6 subplots:
- H(q) vs q: Generalized Hurst exponent
- τ(q) vs q: Mass exponent
- D(q) vs q: Generalized dimension
- α(q) vs q: Singularity strength
- f(α) vs α: Multifractal spectrum
- Overview: Normalized comparison of all indices
Parameters:
df_mfs(DataFrame): Results returned byget_mfs()
Theoretical Background
MFDFA Method
Multifractal Detrended Fluctuation Analysis (MFDFA) is a generalization of the DFA method with the following steps:
1. Cumulative Deviation
2. Segment Detrending
Divide Y(i) into non-overlapping windows of size s, fit polynomials in each window, and calculate variance.
3. Fluctuation Function
4. q-order Fluctuation Function
5. Scaling Law
Where h(q) is the generalized Hurst exponent.
Multifractal Parameters
1. Mass Exponent τ(q)
2. Singularity Strength α(q)
3. Multifractal Spectrum f(α)
4. Generalized Dimension D(q)
Important Notes
- Sequence Length:
- Minimum length recommended ≥ 1000
- Longer sequences produce more stable results
- For short sequences, reduce number of scales
- q Value Selection:
- Negative q: Sensitive to small fluctuations
- Positive q: Sensitive to large fluctuations
- Recommended range: -5 to 5
- Recommended points: 20-50
- Scale Parameters:
order=1: Suitable for trendless sequencesorder=2: Suitable for linear trends (recommended)order=3: Suitable for quadratic trends- Use
recommended_lag()for optimal scale selection
- Result Interpretation:
- h(q) monotonically decreasing: Multifractal
- h(q) constant: Monofractal
- Δh > 0.1: Significant multifractality
- Wider f(α): Stronger heterogeneity
- Performance Considerations:
- Long sequences compute slowly
- Reduce number of q values to speed up
- Use
recommended_lagfunction for optimized scale selection
References
- Kantelhardt, J. W., et al. (2002). Multifractal detrended fluctuation analysis of nonstationary time series. Physica A.
- Peng, C. K., et al. (1994). Mosaic organization of DNA nucleotides. Physical Review E.