I am trying to estimate daily Hurst exponent values of a stock returns (e.g. for each day to have also Hurst exponent - something like that: https://www.quandl.com/data/PE/CKEC_HURST-Hurst-Exponent-of-Carmike-Cinemas-Inc-Common-Stock-CKEC-NASDAQ).

I am using tis Python code (taken from https://www.quantstart.com/articles/Basics-of-Statistical-Mean-Reversion-Testing), but I do not how to accomodate it for daily Hurst values instead of just one value:

from numpy import cumsum, log, polyfit, sqrt, std, subtract

from numpy.random import randn

def hurst(ts):

    """Returns the Hurst Exponent of the time series vector ts"""
    # Create the range of lag values
    lags = range(2, 100)

    # Calculate the array of the variances of the lagged differences
    tau = [sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in lags]

    # Use a linear fit to estimate the Hurst Exponent
    poly = polyfit(log(lags), log(tau), 1)

    # Return the Hurst exponent from the polyfit output
    return poly[0]*2.0
  • 1
    $\begingroup$ you can call the function by modifying the input time serie (ts) each time : using a rolling window approach. Example : first call with ts = [1:200], second call with ts = [2:201] $\endgroup$ – Malick Dec 28 '15 at 18:59
  • $\begingroup$ You can't compute a Hurst exponent from 1 daily observation, you need a range of many days. It is unclear how the chart you showed is computed, it must be over a certain number of past days, i.e. with a moving window that is moved forward each day. $\endgroup$ – noob2 Dec 28 '15 at 18:59
  • $\begingroup$ If you dont mind using matlab, you can find a lot of implementations of the Hurst exponent here: prorum.com/index.php/2173/… Some of them calculates the Hurst Exponent over time (if I correctly understand it is what you are looking for): prorum.com/index.php/2173/… $\endgroup$ – DanielTheRocketMan Feb 9 '16 at 15:50
  • 1
    $\begingroup$ @DanielTheRocketMan: Thank you, this is what I was looking for! $\endgroup$ – Marcus Feb 9 '16 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.