I have a dataframe as below. I would like to apply a function I have defined ( hurst() ) to each column (it takes a time series as an argument) and then output the results to another data frame.
def hurst(ts):
#returns the Hurst Exponent of the time series vector ts
# Create the range of lag values
lags = range (1,5)
# 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
How do I get from this
to
The full data frame has a 1y Dt history and continues E, F etc