Skip to main content

Hurst exponent estimation usding Whittle's method

Project description

README

Overview

This module provides an implementation of Whittle's likelihood method to estimate the Hurst exponent of a time series. The method fits a theoretical spectral density model to the periodogram of a time series. This implementation supports multiple spectral density approximations for fractional Gaussian noise (increments of fractional Brownian motion) and ARFIMA processes.

Features

  • Estimate the Hurst exponent (H) by minimizing the Whittle likelihood function.
  • Spectral density options:
    • fGn
    • arfima
    • fGn_paxson
    • fGn_truncation
    • fGn_taylor
  • Flexible interface with an option for a custom spectral density callback.
  • Included generators for fBm, and ARFIMA:

Installation

pip install whittlehurst

Usage

fBM or fGn

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)
fGn_seq = np.diff(fBm_seq)

# Estimate the Hurst exponent
H_est = whittle(fGn_seq)

print(f"Original H: {H:0.04f}, estimated H: {H_est:0.04f}")

ARFIMA

import numpy as np
from whittlehurst import whittle, arfima

# Original Hurst value to test with
H=0.42

# Generate an ARFIMA(0, H - 0.5, 0) realization
arfima_seq = arfima(H=H, n=10000)

# No need to take the increments here
# Estimate the "Hurst exponent"
H_est = whittle(arfima_seq, spectrum="arfima")

print(f"Original H: {H:0.04f}, estimated H: {H_est:0.04f}")

Notes

  • The default recommended spectral model is fGn which relies on Hurwitz's zeta function.
  • fGn_paxson, fGn_truncation, fGn_taylor are experimental approximations of the fGn spectrum.
  • For models fGn_paxson and fGn_truncation, the parameter K is configurable (defaults: 50 and 200 respectively).
  • A custom spectral density function may be provided via the spectrum_callback parameter.

References

The initial implementation of Whittle's method was based on:
https://github.com/JFBazille/ICode/blob/master/ICode/estimators/whittle.py

For details on spectral density models for fractional Gaussian noise, refer to:
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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whittlehurst-0.5.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whittlehurst-0.5-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file whittlehurst-0.5.tar.gz.

File metadata

  • Download URL: whittlehurst-0.5.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.9

File hashes

Hashes for whittlehurst-0.5.tar.gz
Algorithm Hash digest
SHA256 e671d4fd24fdb0e1e5d63fa7822be3881361d65cd7d52556ab7fe25c06c510bb
MD5 62160a31c14a44f8bea425e88b50a14f
BLAKE2b-256 852f2b6f65fcc291a491e5f58b52529af4bde4aa3beca28cb849a88410da1125

See more details on using hashes here.

File details

Details for the file whittlehurst-0.5-py3-none-any.whl.

File metadata

  • Download URL: whittlehurst-0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.9

File hashes

Hashes for whittlehurst-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5ccf1afff7675da3a9fcc864c68eb0be6d16ca134ffb7a73ed91ee43faf6e95d
MD5 1daef38260e299bd80095af0e8aeeb2b
BLAKE2b-256 3255003037f0ccf3b9aa4b924d65596ea7ab4764576fe83e3cb11ee0ba52750b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page