https://github.com/aielte-research/whittlehurst
This module implements Whittle's likelihood estimation method for determining the Hurst exponent of a time series.
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: wiley.com -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.5%) to scientific vocabulary
Repository
This module implements Whittle's likelihood estimation method for determining the Hurst exponent of a time series.
Basic Info
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Overview
This module implements Whittle's likelihood estimation method for determining the Hurst exponent of a time series. The method fits the theoretical spectral density to the periodogram computed from the time series realization. This implementation includes spectral density approximations for fractional Gaussian noise (increments of fractional Brownian motion) and ARFIMA processes.
The Hurst exponent ($H$) controls the roughness, self-similarity, and long-range dependence of fBm paths:
- $H\in(0,0.5):~$ anti-persistent (mean-reverting) behavior.
- $H=0.5:~ \mathrm{fBm}(H)$ is the Brownian motion.
- $H\in(0.5,1):~$ persistent behavior.
Features
- Spectral density options:
fGn(This is the current default option, corresponding to fGn_Paxson, with K=10)arfimafGn_PaxsonfGn_HurwitzfGn_truncationfGn_Taylor
- A flexible interface that supports custom spectral density callback functions.
- Good performance both in terms of speed and accuracy.
- Included generators for fBm and ARFIMA.
Installation
pip install whittlehurst
Usage
Whittle for fBm and fGn
```python import numpy as np from whittlehurst import whittle, fbm
Original Hurst value to test with
H=0.42
Generate an fBm realization
fBm_seq = fbm(H=H, n=10000)
Calculate the increments (the estimator works with the fGn spectrum)
fGnseq = np.diff(fBmseq)
Estimate the Hurst exponent
Hest = whittle(fGnseq)
print(f"Original H: {H:0.04f}, estimated H: {H_est:0.04f}") ```
TDML for fGn
The Time-Domain Maximum Likelihood (TDML) method estimates $H$ from fGn observations by fitting the likelihood function directly in the time domain. TDML performs a similar root finding as Whittle's method, but Whittle operates in the frequency domain. Despite significant optimizations TDML remains much slower than Whittle. TDML offers marginally improved accuracy, especially at the edges of the Hurst parameter range.
Usage: ```python import numpy as np from whittlehurst import tdml, fbm
Original Hurst value to test with
H=0.42
Generate an fBm realization
fBm_seq = fbm(H=H, n=10000)
Calculate the increments
fGnseq = np.diff(fBmseq)
Estimate the Hurst exponent
Hest = tdml(fGnseq)
print(f"Original H: {H:0.04f}, estimated H: {H_est:0.04f}") ```
ARFIMA
```python import numpy as np from whittlehurst import whittle, arfima
Original Hurst value to test with
H=0.42
Generate a realization of an ARFIMA(0, H - 0.5, 0) process.
arfima_seq = arfima(H=H, n=10000)
No need to take the increments here
Estimate the "Hurst exponent" using the ARFIMA spectrum
Hest = whittle(arfimaseq, spectrum="arfima")
print(f"Original H: {H:0.04f}, estimated H: {H_est:0.04f}") ```
Performance
Compared to other methods
Our Whittle-based estimator offers a compelling alternative to traditional approaches for estimating the Hurst exponent. In particular, we compare it with:
R/S Method: Implemented in the hurst package, this method has been widely used for estimating $H$.
Higuchi's Method: Available through the antropy package, it performs quite well especially for smaller $H$ values, but its performance drops when $H\rightarrow 1$.
DFA: Detrended Fluctuation Analysis is a popular Hurst estimator robust for non-stationary processes (this robustness is not required in the below tests). Available through the nolds package.
Variogram: Our variogram implementation of order $p = 1$ (madogram) accessible as
from whittlehurst import variogram.TDML: Our TDML implementation.

Inference times represent the computation time per input sequence, and were calculated as: $t = w\cdot T/k$, where $k=100000$ is the number of sequences, $w=32$ is the number of workers (processing threads), and $T$ is the total elapsed time. Single-thread performance is likely superior, the results are mainly comparative.

The following results were calculated on $100000$ fBm realizations of length $n=2048$.


fGn spectral density approximations
The fGn spectral density calculations recommended by Shi et al. are accessible within our package:
fGnorfGn_Paxson: The default recommended spectral model. Uses Paxson's approximation with a configurable parameterK=10.fGn_Hurwitz: Relies on the gamma function and the Hurwitz zeta function $\zeta(s,q)=\sum_{j=0}^{\infty}(j+q)^{-s}$ from scipy.fGn_truncation: Approximates the infinite series by a configurable truncationK=200.fGn_Taylor: Uses a Taylor series expansion to approximate the spectral density at near-zero frequency.


The following results were calculated on $100000$ fBm realizations of length $n=2048$.


ARFIMA
For the $\text{ARFIMA}(0, H - 0.5, 0)$ process, the spectral density calculation is simpler. With terms independent from $H$ or $\lambda$ omitted, we use:
$g(\lambda,H) = (2\cdot\sin(\lambda/2))^{1 - 2H}$

References
- The initial implementation of Whittle's method was adapted from:
https://github.com/JFBazille/ICode/blob/master/ICode/estimators/whittle.py
- For further details on spectral density models for fractional Gaussian noise, refer to:
Shuping Shi, Jun Yu, and Chen Zhang. Fractional gaussian noise: Spectral density and estimation methods. Journal of Time Series Analysis, 2024. https://onlinelibrary.wiley.com/doi/full/10.1111/jtsa.12750
License
This project is licensed under the MIT License (c) 2025 Bálint Csanády, aielte-research. See the LICENSE file for details.
Owner
- Name: aielte-research
- Login: aielte-research
- Kind: organization
- Repositories: 1
- Profile: https://github.com/aielte-research
GitHub Events
Total
- Watch event: 9
- Push event: 20
- Public event: 1
Last Year
- Watch event: 9
- Push event: 20
- Public event: 1
Packages
- Total packages: 1
-
Total downloads:
- pypi 74 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 8
- Total maintainers: 1
pypi.org: whittlehurst
Hurst exponent estimation using Whittle's method
- Homepage: https://github.com/aielte-research/whittlehurst.git
- Documentation: https://whittlehurst.readthedocs.io/
- License: MIT
-
Latest release: 1.1
published about 1 year ago