original_docstring: Estimate the Hurst exponent using R/S method.
  
      Estimates the Hurst (H) exponent using the DMA method from the time series.
      The DMA method consists on calculate the moving average of size `series_len`
      and subtract it to the original series and calculating the standard
      deviation of that result. This repeats the process for several `series_len`
      values and adjusts data regression to obtain the H. `series_len` will take
      values between `min_chunksize` and `max_chunksize`, the step size from
      `min_chunksize` to `max_chunksize` can be controlled through the parameter
      `step_chunksize`.
  
      Parameters
      ----------
      prices
      min_chunksize
      max_chunksize
      num_chunksize
  
      Returns
      -------
      hurst_exponent : float
          Estimation of hurst exponent.
  
      References
      ----------
      Alessio, E., Carbone, A., Castelli, G. et al. Eur. Phys. J. B (2002) 27:
      197. https://dx.doi.org/10.1140/epjb/e20020150
  
      
docstring: Estimate the Hurst exponent using R/S method.
  Estimates the Hurst (H) exponent using the DMA method from the time series.
  The DMA method consists on calculate the moving average of size `series_len`
  and subtract it to the original series and calculating the standard
  deviation of that result. This repeats the process for several `series_len`
  values and adjusts data regression to obtain the H.
  
  Parameters
  
  
  
  Returns
  
  hurst_exponent : float
  Estimation of hurst exponent.
  
  References
  
  Alessio, E., Carbone, A., Castelli, G. et al. Eur. Phys. J.
docstring_tokens: Estimate the Hurst exponent using R / S method . Estimates the Hurst ( H ) exponent using the DMA method from the time series . The DMA method consists on calculate the moving average of size ` series_len ` and subtract it to the original series and calculating the standard deviation of that result . This repeats the process for several ` series_len ` values and adjusts data regression to obtain the H . Parameters Returns hurst_exponent : float Estimation of hurst exponent . References Alessio E . Carbone A . Castelli G . et al . Eur . Phys . J .
code: def hurst_dma(prices, min_chunksize=8, max_chunksize=200, num_chunksize=5):
      """Estimate the Hurst exponent using R/S method.
  
      Estimates the Hurst (H) exponent using the DMA method from the time series.
      The DMA method consists on calculate the moving average of size `series_len`
      and subtract it to the original series and calculating the standard
      deviation of that result. This repeats the process for several `series_len`
      values and adjusts data regression to obtain the H. `series_len` will take
      values between `min_chunksize` and `max_chunksize`, the step size from
      `min_chunksize` to `max_chunksize` can be controlled through the parameter
      `step_chunksize`.
  
      Parameters
      ----------
      prices
      min_chunksize
      max_chunksize
      num_chunksize
  
      Returns
      -------
      hurst_exponent : float
          Estimation of hurst exponent.
  
      References
      ----------
      Alessio, E., Carbone, A., Castelli, G. et al. Eur. Phys. J. B (2002) 27:
      197. https://dx.doi.org/10.1140/epjb/e20020150
  
      """
      max_chunksize += 1
      N = len(prices)
      n_list = np.arange(min_chunksize, max_chunksize, num_chunksize, dtype=np.int64)
      dma_list = np.empty(len(n_list))
      factor = 1 / (N - max_chunksize)
      # sweeping n_list
      for i, n in enumerate(n_list):
          b = np.divide([n - 1] + (n - 1) * [-1], n)  # do the same as:  y - y_ma_n
          noise = np.power(signal.lfilter(b, 1, prices)[max_chunksize:], 2)
          dma_list[i] = np.sqrt(factor * np.sum(noise))
  
      H, const = np.linalg.lstsq(
          a=np.vstack([np.log10(n_list), np.ones(len(n_list))]).T,
          b=np.log10(dma_list)
      )[0]
      return H
code_tokens: def hurst_dma ( prices , min_chunksize = 8 , max_chunksize = 200 , num_chunksize = 5 ) : max_chunksize += 1 N = len ( prices ) n_list = np . arange ( min_chunksize , max_chunksize , num_chunksize , dtype = np . int64 ) dma_list = np . empty ( len ( n_list ) ) factor = 1 / ( N - max_chunksize ) for i , n in enumerate ( n_list ) : b = np . divide ( [ n - 1 ] + ( n - 1 ) * [ - 1 ] , n ) noise = np . power ( signal . lfilter ( b , 1 , prices ) [ max_chunksize : ] , 2 ) dma_list [ i ] = np . sqrt ( factor * np . sum ( noise ) ) H , const = np . linalg . lstsq ( a = np . vstack ( [ np . log10 ( n_list ) , np . ones ( len ( n_list ) ) ] ) . T , b = np . log10 ( dma_list ) ) [ 0 ] return H
short_docstring: Estimate the Hurst exponent using R/S method.
short_docstring_tokens: Estimate the Hurst exponent using R / S method .
comment: """Estimate the Hurst exponent using R/S method.
  
      Estimates the Hurst (H) exponent using the DMA method from the time series.
      The DMA method consists on calculate the moving average of size `series_len`
      and subtract it to the original series and calculating the standard
      deviation of that result. This repeats the process for several `series_len`
      values and adjusts data regression to obtain the H. `series_len` will take
      values between `min_chunksize` and `max_chunksize`, the step size from
      `min_chunksize` to `max_chunksize` can be controlled through the parameter
      `step_chunksize`.
  
      Parameters
      ----------
      prices
      min_chunksize
      max_chunksize
      num_chunksize
  
      Returns
      -------
      hurst_exponent : float
          Estimation of hurst exponent.
  
      References
      ----------
      Alessio, E., Carbone, A., Castelli, G. et al. Eur. Phys. J. B (2002) 27:
      197. https://dx.doi.org/10.1140/epjb/e20020150
  
      """$SEP$# sweeping n_list$SEP$# do the same as:  y - y_ma_n