hurst_estimators

hurst_estimators.estimators

hurst_estimators.estimators.central_estimator(X: ndarray, max_window_size: int, *, min_window_size: int = 10, r: int = 1, num_sizes: int = 20) Tuple[float, float, float, ndarray, ndarray][source]

Estimate the Hurst exponent of a time series using moments of specified degree.

Parameters:
  • X (np.ndarray) – The time series data.

  • max_window_size (int) – The maximum window size to use for computations.

  • min_window_size (int) – The minimum window size to use for computations.

  • r (int) – The degree of the moment to use in the calculation.

  • num_sizes (int) – The number of different window sizes to use.

Returns:

hurst (float): The estimated Hurst exponent. slope (float): The slope of the regression line. intercept (float): The intercept of the regression line. log_sizes (np.ndarray): Logarithms of the window sizes used. log_moments (np.ndarray): Logarithms of the computed moments for each window size.

Return type:

Tuple containing

hurst_estimators.estimators.dfa_estimator(X: ndarray, w: int, *, alpha: float = 0.99) Tuple[float, float, float, ndarray, ndarray][source]

Estimate the Hurst exponent using Detrended Fluctuation Analysis (DFA).

Parameters:
  • X (np.ndarray) – The time series data.

  • w (int) – The window size for calculating the fluctuation function.

  • alpha (float) – The percentage for the starting point of the search (default is 0.99).

Returns:

hurst (float): Estimated Hurst exponent. slope (float): The slope of the regression line. intercept (float): The intercept of the regression line. log_window_sizes (np.ndarray): Logarithm of window sizes used in the estimation. log_fluctuations (np.ndarray): Logarithm of fluctuations corresponding to each window size.

Return type:

Tuple containing

hurst_estimators.estimators.ghe_estimator(X: ndarray, max_tau: int = 20, *, q: float = 2.0) Tuple[float, float, float, ndarray, ndarray][source]

Estimates the Generalized Hurst exponent of a time series using the q-th order moments.

Parameters:
  • X (np.ndarray) – Time series data.

  • q (float) – Order of the moments.

  • max_tau (int) – Maximum time lag.

Returns:

Estimated Hurst exponent. List[float]: Logarithm of time lags. List[float]: Logarithm of q-th order moments.

Return type:

float

hurst_estimators.estimators.higuchi_estimator(X: ndarray, min_window_size: int, max_window_size: int, *, num_windows: int = 20) Tuple[float, float, float, ndarray, ndarray][source]

Estimates the Hurst exponent of a time series using the Higuchi method.

Parameters:
  • X (np.ndarray) – Time series data.

  • min_window_size (int) – Minimum window size for calculating normalized lengths.

  • max_window_size (int) – Maximum window size for calculating normalized lengths.

  • num_windows (int) – Number of window sizes to compute.

Returns:

hurst (float): Estimated Hurst exponent. slope (float): The slope of the regression line. intercept (float): The intercept of the regression line. log_window_sizes (np.ndarray): Logarithm of window sizes used in the estimation. log_mean_normalized_lengths (np.ndarray): Logarithm of mean normalized lengths corresponding to each window size.

Return type:

Tuple containing

hurst_estimators.estimators.periodogram_estimator(X: ndarray) Tuple[float, float, float, ndarray, ndarray][source]

Estimates the Hurst exponent of a time series using the periodogram method.

Parameters:

X (np.ndarray) – Time series data.

Returns:

hurst_exponent (float): Estimated Hurst exponent. log_frequencies (np.ndarray): Logarithm of frequencies used for regression. log_periodogram (np.ndarray): Logarithm of power spectrum values corresponding to the frequencies.

Return type:

Tuple containing

hurst_estimators.estimators.rs_estimator(X: ndarray, w: int, *, alpha: float = 0.99) Tuple[float, float, float, ndarray, ndarray][source]

Estimate the Hurst exponent using Rescaled Range Analysis (R/S Analysis).

Parameters:
  • X (np.ndarray) – The time series data.

  • w (int) – The window size for calculating the rescaled range.

  • alpha (float) – The percentage for the starting point of the search (default is 0.99).

Returns:

hurst (float): Estimated Hurst exponent. slope (float): The slope of the regression line. intercept (float): The intercept of the regression line. log_window_sizes (np.ndarray): Logarithm of window sizes used in the estimation. log_rs_values (np.ndarray): Logarithm of rescaled range values corresponding to each window size.

Return type:

Tuple containing

hurst_estimators.estimators.wavelet_estimator(X: ndarray, method: str = 'awc', wavelet: str = 'db1') Tuple[float, float, float, ndarray, ndarray][source]

Estimates the Hurst exponent using specified methods: ‘awc’ (Average Wavelet Coefficients) or ‘vvl’ (Variance Versus Level).

Parameters:
  • X (np.ndarray) – Time series data.

  • method (str) – Estimation method, either ‘awc’ for average wavelet coefficients or ‘vvl’ for variance versus level.

  • wavelet (str) – Type of wavelet to use, default ‘db1’.

Returns:

hurst (float): Estimated Hurst exponent. slope (float): The slope of the regression line. intercept (float): The intercept of the regression line. log_scales (np.ndarray): Logarithm of scales or levels. log_values (np.ndarray): Logarithm of mean or variance of wavelet coefficients.

Return type:

Tuple containing

Raises:

ValueError – If the method is not ‘awc’ or ‘vvl’.

hurst_estimators.simulators

hurst_estimators.simulators.generate_fgn(length: int, hurst: float) ndarray[source]

Generate a Fractal Gaussian Noise (FGN) sequence of a specified length and Hurst exponent.

Parameters:
  • length (int) – Length of the sequence.

  • hurst (float) – Hurst exponent, H (0 < H < 1).

Returns:

Generated FGN sequence.

Return type:

np.ndarray

hurst_estimators.utils

hurst_estimators.utils.search_opt_seq_len(N: int, w: int, alpha: float = 0.99) int[source]

Search the optimal sequence length.

Parameters:
  • N (int) – Original sequence length.

  • w (int) – Lower bound for factors.

  • alpha (float) – Percentage for the starting point of the search.

Returns:

Optimal sequence length.

Return type:

int