OU Processes#

These are the classes that implement gaussian and non-gaussian Ornstein-Uhlenbeck <https://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process> process.

class quantflow.sp.ou.Vasicek(*, rate: ~typing.Annotated[float, ~annotated_types.Gt(gt=0)] = 1.0, kappa: ~typing.Annotated[float, ~annotated_types.Gt(gt=0)] = 1.0, bdlp: ~quantflow.sp.weiner.WeinerProcess = <factory>, theta: ~typing.Annotated[float, ~annotated_types.Gt(gt=0)] = 1.0)#

Gaussian OU process, also know as the Vasiceck model.

Strictly, it is not an intensity process since it is not positive

Methods:

analytical_cdf

Analytical cdf of the process at time t

analytical_mean

Analytical mean of the process at time t

analytical_pdf

Analytical pdf of the process at time t

analytical_variance

Analytical variance of the process at time t

characteristic_exponent

Characteristic exponent at time t for a given input parameter

integrated_log_laplace

The log-Laplace transform of the cumulative process:

sample

Generate random Paths from the process.

sample_from_draws

Sample Paths from the process given a set of draws

Attributes:

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

analytical_cdf(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, x: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float#

Analytical cdf of the process at time t

Implement if available

analytical_mean(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float#

Analytical mean of the process at time t

Implement if available

analytical_pdf(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, x: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float#

Analytical pdf of the process at time t

Implement if available

analytical_variance(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float#

Analytical variance of the process at time t

Implement if available

characteristic_exponent(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series#

Characteristic exponent at time t for a given input parameter

integrated_log_laplace(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series#

The log-Laplace transform of the cumulative process:

\[e^{\phi_{t, u}} = {\mathbb E} \left[e^{i u \int_0^t x_s ds}\right]\]
Parameters:
  • t – time horizon

  • u – frequency

sample(n: int, time_horizon: float = 1, time_steps: int = 100) Paths#

Generate random Paths from the process.

Parameters:
  • n – number of paths

  • time_horizon – time horizon

  • time_steps – number of time steps to arrive at horizon

sample_from_draws(draws: Paths, *args: Paths) Paths#

Sample Paths from the process given a set of draws

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class quantflow.sp.ou.GammaOU(*, rate: Annotated[float, Gt(gt=0)] = 1.0, kappa: Annotated[float, Gt(gt=0)] = 1.0, bdlp: CompoundPoissonProcess[Exponential])#

Methods:

analytical_mean

Analytical mean of the process at time t

analytical_pdf

Analytical pdf of the process at time t

analytical_variance

Analytical variance of the process at time t

characteristic_exponent

Characteristic exponent at time t for a given input parameter

cumulative_characteristic2

Formula from a paper

integrated_log_laplace

The log-Laplace transform of the cumulative process:

sample

Generate random Paths from the process.

Attributes:

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

analytical_mean(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float#

Analytical mean of the process at time t

Implement if available

analytical_pdf(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, x: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float#

Analytical pdf of the process at time t

Implement if available

analytical_variance(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float#

Analytical variance of the process at time t

Implement if available

characteristic_exponent(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series#

Characteristic exponent at time t for a given input parameter

cumulative_characteristic2(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series#

Formula from a paper

integrated_log_laplace(t: ndarray[tuple[int, ...], dtype[floating[Any]]] | float, u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series#

The log-Laplace transform of the cumulative process:

\[e^{\phi_{t, u}} = {\mathbb E} \left[e^{i u \int_0^t x_s ds}\right]\]
Parameters:
  • t – time horizon

  • u – frequency

sample(n: int, time_horizon: float = 1, time_steps: int = 100) Paths#

Generate random Paths from the process.

Parameters:
  • n – number of paths

  • time_horizon – time horizon

  • time_steps – number of time steps to arrive at horizon

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].