HT

class fathon.HT(tsVec)

Bases: object

Time-dependent local Hurst exponent class.

Parameters:

tsVec (iterable) – Time series used for the analysis.

computeHt(scales, polOrd=1, mfdfaPolOrd=1, q0Fit=[], verbose=False)

Computation of the time-dependent local Hurst exponent at each scale, using Ihlen’s approach.

Parameters:
  • scales (int or iterable or numpy ndarray) – Window’s sizes used for the computation of the time-dependent local Hurst exponent.

  • polOrd (int, optional) – Order of the polynomial to be fitted in each window (default : 1).

  • mfdfaPolOrd (int, optional) – Order of the polynomial to be fitted to MFDFA’s fluctuations at q = 0 (default : 1).

  • q0Fit (iterable or numpy ndarray of floats, optional) – MFDFA’s Hurst exponent at order q = 0 and the corresponding intercept of the fit, [hq0, hq0_intercept]. These values must come from a log-log fit, with the log base equal to e. If not empty, it will be directly used to compute the time-dependent local Hurst exponent, ignoring mfdfaPolOrd value (default : []).

  • verbose (bool, optional) – Verbosity (default : False).

Returns:

Time-dependent local Hurst exponent.

Return type:

numpy ndarray

saveObject(outFileName)

Save current object state to binary file.

Parameters:

outFileName (str) – Output binary file. .fathon extension will be appended to the file name.

Usage examples

import numpy as np
import fathon
from fathon import fathonUtils as fu

#time series
a = np.random.randn(10000)

#zero-mean cumulative sum
a = fu.toAggregated(a)

#initialize ht object
pyht = fathon.HT(a)
#compute time-dependent Hurst exponent
ht = pyht.computeHt([100, 200, 1000], mfdfaPolOrd=1, polOrd=1)