cumcovarTopN

Syntax

cumcovarTopN(X, Y, S, top, [ascending=true], [tiesMethod='latest'])

Please see Cumulative Moving TopN Functions for the parameters and windowing logic.

Details

The function stably sorts X and Y by S in the order specified by ascending, then calculates the covariance of the first top pairs of elements in X and Y in a cumulative window.

Return value: DOUBLE type

Examples

X=1 2 3 10 13 4 3
Y = 1 7 8 9 0 5 8
S = 0.3 0.5 0.1 0.1 0.5 0.2 0.4
cumcovarTopN(X, Y, S, 6, 3)
// output
[,3,3.5,9.6666,-4,-3.2,-3.3333]