FractionalEulerProcess¶
- class samplepaths.diffusion.FractionalEulerProcess(*, hurst=0.7, t=1.0, rng=None)[source]¶
Bases:
EulerMaruyamaProcessBase class of the diffusions driven by a fractional Brownian motion.
A process \(X_t\) which satisfies the stochastic differential equation
\[dX_t = a(X_t) dt + b(X_t) dB^H_t\]with fractional Brownian motion \(B^H_t\) of Hurst parameter \(H\). With \(H > 1/2\) the increments of the motion are positively correlated and the process has a long memory; with \(H < 1/2\) they are negatively correlated and the process is rough. With \(H = 1/2\) the motion is a Wiener process.
Realizations are generated using the Euler method with exact increments of the fractional Brownian motion, and every value is confined to the domain of the process. The method is known to converge for \(H > 1/2\).
- Parameters:
- property n: int¶
Number of increments of the most recent realization.
- Raises:
RuntimeError – if no realization has been generated yet
- property rng: Generator¶
Random number generator used by the process.
This is the generator passed at instantiation, or the package default
samplepaths.random.generatorwhen none was given.
- sample(n)¶
Generate a realization.
- Parameters:
n (int) – the number of increments to generate
- Returns:
the realization
- Return type:
NDArray[float64]
- sample_at(times)¶
Generate a realization at specified times.
- Parameters:
times (NDArray[float64]) – a vector of increasing time values at which to generate the realization
- Returns:
the realization
- Raises:
NotImplementedError – if the process does not support sampling at specified times
- Return type:
NDArray[float64]
- sample_paths(n, paths, workers=1)¶
Generate several independent realizations at once.
The realizations have the distribution of those of
sample(). Many processes generate them together, which is much faster than callingsample()repeatedly. For a given seed, the values differ from those of repeated calls tosample(), because the random numbers are drawn in a different order.With
workersgreater than one, the realizations are generated on that many threads, each with its own generator derived from the generator of the process. The result is reproducible for a given seed and number of workers, and differs between numbers of workers. Processes which generate their realizations one after the other ignoreworkers.
- sample_paths_with_initial(n, paths, initial, workers=1)¶
Generate several realizations starting from an initial value.
- sample_with_initial(n, initial)¶
Generate a realization starting from an initial value.
- set_times(n)¶
Generate the time values of n increments on [0, t].
- set_times_with_t(end_t, n)¶
Generate the time values of n increments on [0, end_t].