Petrosian Fractal Dimension

The Petrosian Fractal Dimension (PFD), from Arthur Petrosian’s 1995 work on EEG recordings, measures roughness by how often the path changes direction: it reduces the series to the signs of its changes and counts how often the sign flips.

The formula for the Petrosian Fractal Dimension takes the number of log prices N and the number of sign changes \(N_{\delta}\) of the returns, the changes between consecutive log prices:

\[\text{FD} = \frac{\log\left(N\right)}{\log\left(N\right) + \log\left(\frac{N}{N + 0.4 \cdot N_{\delta}}\right)}\]

A path that never turns gives 1, and the dimension rises with the number of turns. It looks only at the direction of the moves, not their size, so it is the coarsest measure of roughness.

The fractal dimension measures how rough a path is: how much of the plane it fills rather than how far it travels. A straight line has a dimension of 1 and a path so jagged that it fills the plane a dimension of 2; a price path lies in between. For a self-affine path the dimension is 2 - H, with H the Hurst exponent, so a random walk has a dimension of 1.5, a trending path a lower and a mean-reverting path a higher one. The measures come from the analysis of physiological signals (EEG and other waveforms) and work on the log prices of N periods. Price paths are close to random walks, so the dimensions are mostly of use to compare assets with each other or a rolling estimate over time.

Also known as: PFD, Petrosian dimension.

In the Finance Toolkit this is get_fractal_dimension with method="petrosian", the same function as Fractal Dimension.

Example · EURUSD, GCUSD, BTCUSD · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_fractal_dimension:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["EURUSD", "GCUSD", "BTCUSD"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.risk.get_fractal_dimension(method="petrosian")

Which returns:

References

  • Paper Petrosian, A. (1995). “Kolmogorov complexity of finite sequences and recognition of different preictal EEG patterns.” Proceedings of the Eighth IEEE Symposium on Computer-Based Medical Systems, 212-217.
  • Library Referenced against antropy’s petrosian_fd (Petrosian Fractal Dimension)
Share