Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.8 broke runcov() #49

Open
minhuangr opened this issue Sep 20, 2023 · 4 comments
Open

Version 0.8 broke runcov() #49

minhuangr opened this issue Sep 20, 2023 · 4 comments

Comments

@minhuangr
Copy link

I just upgraded RollingFunctions.jl to 0.8.0 but found runcov() was broken. I have to downgrade to 0.7.0. Is it possibly due to the new padding feature?

runcov(rand(100),rand(100),10)

ERROR: MethodError: no method matching running(::typeof(Statistics.cov), ::Vector{Float64}, ::Vector{Float64}, ::Int64, ::Int64)

I just input one Int64 but the error message suggests two.

@J-Sarnoff
Copy link

thank you -- this release was in response to another request, and an earlier update that never was tagged.
Clearly something is amiss -- looking into it.

@J-Sarnoff
Copy link

for the moment -- you can do this with v0.8

using StatsBase
datalen = 12;
data1 = randn(datalen);
data2 = sort(data1);
window_width = datalen - 2;

cov_1to7 = cov(data1[1:7], data2[1:7]);
cov_1to8 = cov(data1[1:8], data2[1:8]);
cov_1to9 = cov(data1[1:9], data2[1:9]);
cov_789 = [cov_1to7, cov_1to8, cov_1to9];

cov_result = running(cov, data1, data2, window_width);
isapprox(cov_789, cov_result[7:9]) # true, they are == in my test
# re padding

julia> running(cov, data1, data2, window_width)[1:4]
4-element Vector{Float64}:
 NaN
  -0.010042855884454055
  -0.16906938390288762
  -0.23392207942162288

julia> running(cov, data1, data2, window_width; padding=[0.0])[1:4]
4-element Vector{Float64}:
  0.0
 -0.010042855884454055
 -0.16906938390288762
 -0.23392207942162288

running(cov, data1, data2, window_width)

@minhuangr
Copy link
Author

yep, I read the notes for this 1.0 version. Maybe I should post on the main branch.

@J-Sarnoff
Copy link

J-Sarnoff commented Sep 20, 2023

well there is no 1.0 version before there is a 1.0 version -- the branches are playthings
the actual to-be 1.0 version is in a different repository .. this 1.0 branch is just as notes now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants