Calculates the weighted average of the given data.

Namespace:  CenterSpace.NMath.Stats
Assembly:  NMathStats (in NMathStats.dll) Version: 3.4.0.0

Syntax

C#
public static double WeightedMean(
	DoubleVector data,
	DoubleVector weights
)
Visual Basic (Declaration)
Public Shared Function WeightedMean ( _
	data As DoubleVector, _
	weights As DoubleVector _
) As Double
Visual C++
public:
static double WeightedMean(
	DoubleVector^ data, 
	DoubleVector^ weights
)

Parameters

data
Type: CenterSpace.NMath.Core..::.DoubleVector
A vector.
weights
Type: CenterSpace.NMath.Core..::.DoubleVector
A vector of weights.

Return Value

Weighted mean.

Exceptions

ExceptionCondition
CenterSpace.NMath.Core..::.MismatchedSizeException Thrown if data and weights do not have the same length.

See Also