Skip to content
DeepForgeby svx
All problems
HardTime Seriests-225

Rolling Hurst Estimate

Problem

Compute a rolling rescaled-range Hurst estimate. For each window, subtract the mean, form cumulative deviations, take R as max minus min of the path and S as the population standard deviation, and append log(R / S) / log(window).

Return an empty list when window <= 1 or window exceeds the series; windows with zero variance or zero range give 0.0.

Hint

The single-scale exponent here is a rough local persistence measure.

Test cases

case 1
in: [[1,2,3,4,5],3]
expected: [0.18453512321427118,0.18453512321427118,0.18453512321427118]
case 2
in: [[5,5,5,5],2]
expected: [0,0,0]
case 3
in: [[1,2,3,4],4]
expected: [0.41951797627815945]
case 4
in: [[1,2,3],1]
expected: []
Starter codePython
import math
def rolling_hurst_estimate(series, window):
    # Your code here
    pass

4 test cases · run your code against them in the editor