Fractional Brownian Noise (fGN) and Fractional Brownian Motion (fBM) generators in Python.
Project description
fracbm
Fractional Gaussian Noise (fGN) and Fractional Brownian Motion (fBM) tools.
Installation
pip install fracbm
Usage
import matplotlib.pyplot as plt
import fracbm
# Parameters
n = 10000 # number of steps
H = 0.7 # Hurst parameter
# Fractional Brownian motion using Davies–Harte
fbm_path = fracbm.daviesharte.motion(n, H) # cumulative sum of fGN
fgn_increments = fracbm.daviesharte.noise(n, H) # fractional Gaussian noise
# Wavelet based estimation of Hurst exponent
estimated_hurst = fracbm.invhurst(fbm_path)
print(f'Estimated Hurst Exponent = {estimated_hurst}')
# Plot the full fBm path
plt.figure(figsize=(10, 4))
plt.plot(fbm_path, label="fBM path (Davies–Harte)")
plt.xlabel("Step")
plt.ylabel("Value")
plt.title("Fractional Brownian Motion (H=0.8, Davies–Harte)")
plt.legend()
plt.show()
Features
Generate exact fractional Brownian motion using:
-
Cholesky decomposition, order $\mathcal{O}(n^3)$
-
Davies-Harte method, order $\mathcal{O}(n \log n)$ (recommended)
-
Vary the Hurst parameter $H \in [0,1]$:
-
$H = 0.5$ is regular Brownian motion.
-
$H > 0.5$ causes slowly decaying positive autocorrelations (positive increments tend to follow positive increments - increments follow a trend).
-
$H < 0.5$ causes fast-decaying negative autocorrelations (negative increments tend to follow positive increments - increments revert to the mean).
Determine the Hurst exponent of a time series:
- Wavelet transform method
- For n ~ 10000 or greater
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fracbm-0.3.0.tar.gz.
File metadata
- Download URL: fracbm-0.3.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baf8070b8749b4f0d3af92fd1e3c0f24426927183be5c82b43c9048040cb0b5d
|
|
| MD5 |
4b4d24266abdcc6b51d645c4aa5ac349
|
|
| BLAKE2b-256 |
d8d75aaf0b17f50676d6b35a51f7acd0e76df88e9875059ae736a4daa9aba950
|
File details
Details for the file fracbm-0.3.0-py3-none-any.whl.
File metadata
- Download URL: fracbm-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70635fb7729bb2cb3fde2c8b6fb4d5487c6fac2d1cda4db3f517f40273a4d92f
|
|
| MD5 |
6ecd10ce323047c49afc72ea787d1d02
|
|
| BLAKE2b-256 |
e686b1af80e2940cef250b247998a07113888f98f4d6e4d3f3fd89c000bd8092
|