cumcovarpTopN

Syntax

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

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

Details

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

Returns

DOUBLE type, with its form determined by X (or Y).

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
cumcovarpTopN(X, Y, S, 6)
// output: [0,1.5,2.33,7.25,-3.2,-2.67,-2.78]

Related Function: covarp