pub fn multifractal_spectrum<T>(
signal: &Signal<T>,
wavelet: &dyn Wavelet,
config: MultifractalConfig,
) -> Result<MultifractalSpectrum>Expand description
Compute multifractal spectrum using wavelet leaders method
This function computes the complete multifractal spectrum f(α) by analyzing wavelet leaders across scales. The wavelet leaders method is more robust than direct wavelet coefficient analysis, especially for heavy-tailed processes.
§Algorithm
- Compute wavelet leaders at each scale and position
- Compute structure functions S(j,q) for each moment q
- Extract scaling exponents ζ(q) via linear regression
- Compute singularity spectrum via Legendre transform
- (Optional) Bootstrap confidence intervals
§Arguments
signal- Input signal to analyzewavelet- Wavelet to use (Daubechies recommended)config- Configuration including moment range and bootstrap settings
§Returns
A MultifractalSpectrum containing the spectrum f(α), scaling exponents ζ(q),
and derived quantities.
§Examples
use iron_wave::analysis::multifractal::*;
use iron_wave::{Signal, Wavelet};
use iron_wave::wavelets::{Daubechies, DaubechiesType};
// Analyze multifractal properties
let data: Vec<f64> = vec![/* your data */];
let signal = Signal::new(data);
let wavelet = Daubechies::new(DaubechiesType::Db4);
let config = MultifractalConfig::with_moments(-3.0, 3.0, 0.5);
let spectrum = multifractal_spectrum(&signal, &wavelet, config)?;
println!("Hurst exponent: {:.3}", spectrum.hurst_exponent);
println!("Spectrum width: {:.3}", spectrum.spectrum_width);
if spectrum.is_multifractal(0.2) {
println!("Signal exhibits multifractal behavior");
println!("Support: ({:.3}, {:.3})", spectrum.alpha_min, spectrum.alpha_max);
}§Notes
- Moment Range: Typical range is q ∈ [-5, 5]. Negative moments probe low-magnitude fluctuations, positive moments probe large fluctuations.
- Bootstrap: Recommended for assessing spectrum reliability, but computationally expensive (cost scales linearly with bootstrap_samples).
- Interpretation: Spectrum width indicates degree of multifractality. Narrow spectrum (< 0.1) suggests monofractal, wide spectrum (> 0.3) indicates strong multifractality.
§Errors
Returns error if:
- Signal too short for scale range
- Wavelet decomposition fails
- Structure function computation fails