All problems
Hurst R/S Estimate
Problem
Estimate the Hurst exponent with a single-scale rescaled range. Subtract the mean and form cumulative deviations; let R be max minus min of that path and S the population standard deviation. Return log(R / S) / log(n).
Return 0.0 if n < 2, S is 0, or R is not positive.
Hint
H near 0.5 suggests a random walk; more persistent series score higher.
Test cases
case 1
in: [[1,2,3,4,5]]
expected: 0.46726791544928875
case 2
in: [[1,2,3,4,5,6,7,8]]
expected: 0.6012804295368734
case 3
in: [[5,5,5]]
expected: 0
case 4
in: [[1,5,2,4,3]]
expected: 0.2153382790366965
Starter codePython
import math
def hurst_rs(series):
# Your code here
pass4 test cases · run your code against them in the editor