crossStat

Syntax

crossStat(X, Y)

Details

Calculates contextCount(X,Y), contextSum(X,Y), contextSum(Y,X), contextSum2(X,Y), contextSum2(Y,X), sum(X*Y). Only elements whose corresponding positions in both X and Y are non-NULL are included in the calculation. If either vector contains NULL at a position, both elements at that position are excluded from all the above statistics.

Parameters

X and Y are numeric vectors of the same size.

Returns

Returns a tuple with the following elements: contextCount(X,Y), contextSum(X,Y), contextSum(Y,X), contextSum2(X,Y), contextSum2(Y,X), sum(X*Y).

Examples

x=1 NULL 2 3
y=4 3 NULL 2
crossStat(x,y);
// output: (2,4,6,10,20,10)