Skip to content

Instantly share code, notes, and snippets.

@Ph0non
Created September 27, 2015 10:36
Show Gist options
  • Save Ph0non/8812716e68388e9ee3a6 to your computer and use it in GitHub Desktop.
Save Ph0non/8812716e68388e9ee3a6 to your computer and use it in GitHub Desktop.
using StatsBase
# zufällige Datenpunkte
data = rand(10000);
# betrachteter Abstand zwischen Datenpunkten
dr = 1;
# Transformation auf Rangzahlen
rx = ordinalrank(data) - 1;
# Generieren einer zweiten Zeitreihe durch Verschiebung
# (Der Eingangswert x für t+1 liegt bei y=f(x) für t)
ry = circshift(rx,-1);
# Ermittle die Indizes
ind_yx = sortperm(rx);
ind_xy = sortperm(ry);
# Ordne den Indizes Werte zu
x = ry[ind_yx];
y = rx[ind_xy];
# Bestimmte die Abstände
drx = x[1+dr : length(data)] - x[1:length(data)-dr];
dry = y[1+dr : length(data)] - y[1:length(data)-dr];
# Berechne die LE_y Statistik
LE_yx = sum(log(abs(dry)./dr))/((length(data)-dr)) - log(dr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment