estimate_hurst_exponent

Function estimate_hurst_exponent 

Source
pub fn estimate_hurst_exponent<T>(
    signal: &Signal<T>,
    wavelet: &dyn Wavelet,
    config: Option<MultifractalConfig>,
) -> Result<HurstResult>
Expand description

Estimate Hurst exponent using wavelet variance method

This function estimates the Hurst exponent H by analyzing how the variance of wavelet coefficients scales across different decomposition levels. For self-similar processes, Var(d_j) ∝ 2^(2jH), allowing H to be estimated via linear regression in log-log space.

§Algorithm

  1. Perform multi-level DWT/MODWT decomposition
  2. Compute variance of detail coefficients at each scale
  3. Perform linear regression of log₂(Var) vs scale j
  4. Extract Hurst exponent as H = slope / 2
  5. (Optional) Bootstrap confidence intervals

§Arguments

  • signal - Input signal to analyze
  • wavelet - Wavelet to use (Daubechies Db2-Db8 recommended)
  • config - Optional configuration (uses defaults if None)

§Returns

A HurstResult containing the estimated Hurst exponent, confidence intervals, and diagnostic information.

§Examples

use iron_wave::analysis::multifractal::*;
use iron_wave::{Signal, Wavelet};
use iron_wave::wavelets::{Daubechies, DaubechiesType};

// Create fractional Brownian motion-like signal
let data: Vec<f64> = (0..512)
    .map(|i| {
        let t = i as f64 * 0.1;
        t.sin() + 0.5 * (2.0 * t).sin()
    })
    .collect();
let signal = Signal::new(data);

let wavelet = Daubechies::new(DaubechiesType::Db4);
let result = estimate_hurst_exponent(&signal, &wavelet, None)?;

println!("H = {:.3} ± {:.3}", result.hurst_exponent, result.confidence_interval);
println!("Interpretation: {}", result.interpretation());
println!("R² = {:.3}", result.r_squared);

if result.is_significant() {
    println!("Significantly different from random walk");
}

§Notes

  • Wavelet Selection: Daubechies wavelets (Db2-Db8) are recommended for Hurst estimation due to their smoothness and vanishing moments.
  • Signal Length: Requires N ≥ 2^min_scale × filter_length. Longer signals provide more reliable estimates.
  • MODWT vs DWT: MODWT is preferred for shift-invariance but requires more computation. DWT is faster but shift-variant.
  • Bootstrap: Provides confidence intervals but increases computation time by factor of bootstrap_samples + 1.

§Errors

Returns error if:

  • Signal is too short for requested scale range
  • Wavelet decomposition fails
  • Regression has insufficient data points