wavg

Syntax

wavg(value, weight)

Arguments

value is the value vector.

weight is the weight vector.

Details

Calculate the weighted average of X with the weight vector Y. Please note that the weight vector Y is automatically scaled such that the sum of the weights is 1.

Examples

wavg(2.2 1.1 3.3, 4 5 6);
// output
2.273333
//  (2.2*4+1.1*5+3.3*6)/(4+5+6)

wavg(1 NULL 1, 1 1 1);
// output
1

Related function: wsum