You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/rqatrend.jl
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ function rqatrend_impl(data; thresh=2, border=10, theiler=1, metric=CheckedEucli
57
57
# simplified implementation of https://stats.stackexchange.com/a/370175 and https://github.com/joshday/OnlineStats.jl/blob/b89a99679b13e3047ff9c93a03c303c357931832/src/stats/linreg.jl
58
58
# x is the diagonal offset, y the percentage of local recurrence
59
59
# we compute the slope of a simple linear regression with bias from x to y
60
-
xs =1+theiler:length(data)-border
60
+
xs =1+theiler:length(data)-border
61
61
x_mean =mean(xs)
62
62
xx_mean =sqmean_step1_range(xs) # mean(x*x for x in xs)
63
63
@@ -70,18 +70,18 @@ function rqatrend_impl(data; thresh=2, border=10, theiler=1, metric=CheckedEucli
70
70
n +=1.0
71
71
y =tau_rr(data, x; thresh, metric)
72
72
y_mean =smooth(y_mean, y, inv(n))
73
-
xy_mean =smooth(xy_mean, x*y, inv(n))
73
+
xy_mean =smooth(xy_mean, x*y, inv(n))
74
74
end
75
-
A = SA_F64[
75
+
A = SA_F64[
76
76
xx_mean x_mean
77
-
x_mean 1.0
77
+
x_mean 1.0
78
78
]
79
79
b = SA_F64[xy_mean, y_mean]
80
80
# OnlineStats uses `Symmetric(A) \ b`, however this does not work for StaticArrays
81
81
# `cholesky(A) \ b` is recommended instead at discourse https://discourse.julialang.org/t/staticarrays-solve-symmetric-linear-system-seems-typeinstable/124634
82
82
# some timings show that there is no significant speedup when adding cholesky or doing plain static linear regression
83
83
# hence leaving it out for now
84
-
return1000.0*(A \b)[1] # slope
84
+
return1000.0* (A\b)[1] # slope
85
85
end
86
86
87
87
@@ -123,7 +123,7 @@ function tau_rr(y, d; thresh=2, metric=CheckedEuclidean())
0 commit comments