Apologies if this is the wrong forum to ask a question such as this.
I was wondering if someone could help me understand where the sqrt and std come from in the following line of code?
tau = [np.sqrt(np.std(np.subtract(ts[lag:], ts[:-lag]))) for lag in lags]
I believe it comes from the following principles, but I just can't reconcile how the formulae (copied below) lead to being able to use the code given, with the std and sqrt. I am also struggling to reconcile what the <| ..... |> symbols mean as well, am I right in thinking that the | | means absolute value or norm of a vector and as stated < ... > means as average of all the data points?
I have seen this question pop up in 2 different forums, so I'm not the only person that is lost, but I've never seen it answered.
Thanks in advance and apologies if this question is not clear, I'm happy to provide further clarification, just let me know.
Var(τ) = 〈|z(t + τ) − z(t)|^2〉
z = log(price)
τ is an arbitrary time lag
〈…〉 is an average over all t’s
For a geometric random walk:
〈|z(t + τ) − z(t)|^2〉 ∼ τ
But if the series is either mean reverting or trending, this relationship will not hold, and instead we get
〈|z(t + τ) − z(t)|^2〉 ∼ τ^2H