Returns an aggregator that uses observations from another variable to compute a weighted average.

Namespace: Extreme.Statistics
Assembly: Extreme.Numerics (Extreme.Numerics)

Syntax

Visual Basic (Declaration)
Public Shared Function WeightedAverage ( _
	weights As NumericalVariable _
) As Aggregator
C#
public static Aggregator WeightedAverage (
	NumericalVariable weights
)
C++
public:
static Aggregator^ WeightedAverage (
	NumericalVariable^ weights
)

Parameters

weights (Extreme.Statistics.NumericalVariable)
A NumericalVariable that contains the weights.

Return Value

An Aggregator object.

Remarks

The weights variable should typically have at least the same length as the variable being aggregated. If it is not long enough to supply all the weights for an aggregation, a ArgumentOutOfRangeException is thrown.

This type of aggregator is used, for example, in financial data analysis to calculate the volume-weighted average of a stock price.