Tools to simulate a 1-D fractional Brownian motion (fBm), build an fOU process, and reproduce estimator diagnostics (almost sure convergence + asymptotic distribution). Code runs in MATLAB or GNU Octave.
├─ Almostsureconvergence_test.m # smoke/diagnostic test (lightweight)
├─ Asymptoticdistribution_test.m # smoke/diagnostic test (lightweight)
├─ eta_quantities.m # main helper for estimator (was: testest)
├─ fbm1d.m # Davies–Harte fBm sampler (1D)
├─ Newton2.m # small Newton solver used by tests
└─ (other .m files as needed)
- MATLAB R2020a+ (recommended), or
- GNU Octave ≥ 8.0 (CI uses 8.4)
No external toolboxes are required.
% In MATLAB, from the repo root
addpath(genpath(pwd)); % add all .m files to the path
% Run the light tests
run('Almostsureconvergence_test.m');
run('Asymptoticdistribution_test.m');
% Example: compute estimator ingredients at level s with stepsize h
[result] = eta_quantities(8, 0.01); % returns [H2, H3]Computes the summary quantities used by the estimator from a simulated fOU path.
s— level (usesn = 2^scoarse steps)h— macro step size Internally simulates fBm viafbm1d, builds the fOU with parameters set at the top of the file (editH,Theta,sigmathere).
Generates a single-path 1D fBm of length N+1 on [0, T] with Hurst H using the Davies–Harte method.
H ∈ (0,1),Ntime steps,Thorizon Returns a column vectorBwithN+1points andB(1)=0.
Minimal Newton solver used by the tests. See the function header for arguments.
The tests are configured light for CI. To run heavier experiments locally:
- In
eta_quantities.m, you can increaseN(fine sub-steps),s(son=2^s), or Monte-Carlo loops (if you add them) for higher fidelity. - Long runs scale roughly linearly with
N * n. Start small (s=7..9, moderateN) and grow as needed.
fbm1d.m uses randn internally. For reproducible runs, set the RNG before calls:
rng(42, 'twister'); % MATLAB
% or in Octave:
rand("seed", 42); randn("seed", 42);The repository includes a GitHub Actions workflow that runs the light tests on Octave to ensure the code compiles and the basic pipeline works. Heavier loops are commented out to keep CI fast.
MIT. See LICENSE.
If you use this code in academic work, please cite the repository:
@misc{FractionalOrnstein,
author = {El Mehdi Haress, Yaozhong Hu},
title = {Fractional Ornstein–Uhlenbeck (fOU) MATLAB/Octave code},
year = {2025},
url = {https://github.com/ElMehdiHaress/FractionalOrnstein}
}
Yaozhong Hu and El Mehdi Haress