In my previous post I mentioned the Hurst Exponent as a measure of the predictability of a time series. I drew a data flow diagram showing the Rescaled Range algorithm, however, thanks to foquant, it has come to our attention that the paper I got the description of the algorithm from does not mention clearly that the algorithm needs to iterate for different sub-periods. foquant attempted to recreate the results in excel and found dissimilar values to the ones shown in the paper [Rasheed et. al.]. Doing a quick google search I came across this excellent presentation which confirms what really needs to be done in order to calculate the Hurst Exponent.
I have re-done the data flow diagram for the algorithm and the steps that need to be performed are shown below:

I have provided an example below which steps through each stage of the algorithm. Hopefully this would make the algorithm easier to understand.
Algorithm Steps
Here I use a returns time series X = X1, X2, …, X1023, X1024 as an example. We shall operate under log2 domain for regression. Matrix dimensions are shown in square brackets [m x n], where m is the number of rows and n is the number of columns.
1. Calculate number of data points
We do this step so that we have a time series with an integer number of sub-periods over which to calculate the rescaled range.
dataPoints = floor(log2(length(data)));
In this example dataPoints = 10. Hence we have 10 sets of sub-periods over which to iterate the rescaled range algorithm. I shall explain what sub-periods are below.
2. Calculate sub-period boundaries
Since we have 10 data points all we need to do to calculate sub-period boundaries is to raise the base to the power of each of the data point numbers. So in this example the sub-period boundaries are 2^(1 through to 10) = 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. These points are essentially the t values on the regression graph. So taking the log of these values reverses the procedure and gives us values 1 through to 10 which shall be the x-axis points on the regression graph.
3. Select sub-period boundary
From this point onwards we iterate through each of the sub-period boundaries. In this case we shall iterate 10 times. Select only 1 sub-period at a time.
4. Calculate the sub-period
Having selected a sub-period boundary we now calculate the sub-period.
subPeriod=floor(N/selectedBoundary);
Here N = 1024 and the selectedBoundary will be from step 2. So if selectedBoundary = 2 then subPeriod = 512. If selectedBoundary = 64 then subPeriod = 16. The table below shows this.

5. Calculate sub-period matrix.
Having calculated the sub-period we now evaluate the sub-period matrix. This is hard to explain using the entire time series X = X1, X2, …, X1023, X1024. But the illustration below tries to explain this using a twelve element time series.

An n sub-period matrix has n columns. So in our first iteration we will create a 512 sub-period matrix. In the second we create a 256 sub-period matrix. Notice that the table shown in step 4 is basically the dimensions of the sub-period matrix, with selectedBoundary being the number of rows and subPeriod being the number of columns. Rows are horizontal, columns are vertical. So sub-period matrix is of dimension [selectedBoundary x subPeriod].
6. Calculate mean of each sub period
For the matrix created in step 5, we calculate the mean of each column i.e. mean of each sub-period. This gives is a matrix of size [1 x subPeriod].
7. Remove mean from each sub-period
Subtract the calculated mean for each column from each row under that column. Do this step for all columns. This procedure results a matrix [selectedBoundary x subPeriod].
8. Calculate cumulative deviation from sub-period mean.
It’s hard to explain, but here is an example with a 3×6 matrix:

This procedure does not alter the size of the matrix and remains as [selectedBoundary x subPeriod].
9. Calculate min and max of cumulative deviation
Take the min of each column of the cumulative deviation and subtract it from the max of each column. This gives a matrix [1x subPeriod] large.
10. Calculate standard deviation of each sub-period.
Here we calculate the standard deviation of each column of the sub-period matrix. We end up with a matrix of size [1 x subPeriod] large.
11. Calculate rescaled range
Divide matrix from step 9 with the standard deviation from step 10. Note that the matrices from steps 9 and 10 are of similar dimension.
12. Take logarithm of mean of rescaled range
To get the y-axis log(R/S) point for the particular sub-period we average the rescaled range matrix from step 11 and take log2 of the calculated average.
13. Take logarithm of sub-period boundary
To complete we take the log2 of the selected sub-period boundary from step 3. This is the x-axis log2(t) point. We now have a log2(R/S) and log2(t) pair to plot on a graph. We go back to step 3 and repeat for a newly selected sub-period boundary.
Having iterated through all sub-period boundary values and plotted them, we perform a regression to get the line of best fit. The slope of this line corresponds to the Hurst Exponent of the returns time series.
I’m not too sure how this procedure would be implemented in Excel, but I imagine it requiring some custom VBA code, particularly for evaluating the sub-period matrix.
Bookmark & Share