# Negative Hurst exponent

I am trying to test Hurst exponent in different time lag range. However, i got negative values in some time lag range which is weird, because the Hurst exponent should have values within the range from 0 to 1.

This is the Python code to calculate the Hurst exponent:

*calculate Hurst*
lag1 = 2
lags = range(lag1, 20)

tau = [sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in lags]

plot(log(lags), log(tau)); show()
m = polyfit(log(lags), log(tau), 1)

hurst = m[0]*2

print 'hurst = ',hurst


When lags = range(200,300), the Hurst exponent is -0.035. My data length is 1643. The log-log plot looks like this, which is not linear:

Is there something wrong with the code or anyone know any good package to test hurst exponent in R or python?

• I got similar results on some indices when I looked at this too. What underlying are you taking returns of?
– will
Oct 25 '19 at 13:22
• I am using Shanghai composite Index Oct 25 '19 at 18:35