Closed tnederlof closed 5 years ago
I am open to this. What are your thoughts?
I also find it useful. Keep a similar syntax for it like:
running((x,y)->some_function(x, y), [A, B], window)
would be nice.
Thanks for being specific -- that helps. Give me some arity-2 functions you would like to use this way.
function running2(fun::Function, A, B, window)
result = Array{Union{Missing,Float64}}(undef, length(A))
offset = window - 1
@inbounds for idx in eachindex(A)
result[idx] = fun(view(A, idx:idx + offset), view(B, idx:idx + offset))
end
result
end
I just defined this and used cov
corr
. Maybe you could consider how to make it work for arbitrary number of arrays or specified columns inside a single Dataframe to make it more general.
cool -- looking into it . do not want to be fixed to DataFrames though
done for 2 data vectors -- see README
You have done a really nice job creating a focused and very useful package, I have learned a lot by reading through the source code as I am fairly new to Julia.
Often times I find the need to do a rolling correlation, rolling least squares regression, etc, which involve calculations between two or more columns of a matrix instead of a single vector. Have you thought about this sort of rolling application before? I would be happy to help and contribute but wasn't sure if it's beyond the spirit of what your package is focused on or if it would fit.