There is this statistical measure called the Hurst exponent; it tells us how much a time series (say, for instance, a series of prices of a financial instrument) is mean reverting or not.

What t is, essentially, is a measure of how the series diffuses from an initial value.

Why am I talking about this? Well, the other day I was messing around with time series and I needed it. In python. Of course, there are some packages out there that calculate it, so I’m not doing anything revolutionary by programming my own Hurst exponent calculator.

But I thought it could be a fun little project.

There are some methods of calculating the Hurst exponent, but the one I find the best (most efficient and easy, and, in one sense, less arbitrary) is the one described by E. P. Chan here.

First I’ll describe the theorem then, next week in the next post, I’ll explain how I programmed it and applied it to a particular case.

### Description

Suppose you have a time series `z = (z_i)_{i=1,…,N}`

, then for `t in T`

, where `T = {1, …, n}`

for `n < N`

,we calculate

```
Var(t) = var(|x_{i+t} - x_i|),
```

where the variance `var`

is over the `i`

and `t in T`

is an arbitrary lag.

`Var(t)`

should obey the following power law:

```
Var(t) ~ t^{2H},
```

where `H`

is the Hurst exponent.

The interpretation of `H`

is the following: if `H < 0.5`

the time series is mean reverting; if `H = 0.5`

the time series is a Brownian motion; and if `H > 0.5`

the time series is trending.