Click or drag to resize

NMathFunctionsWeightedMedian(Double, Double) Method

Returns the weighted median of an array of data with associated non-negative weights. There must be at least one postive non-zero weight.

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
public static double WeightedMedian(
	double[] data,
	double[] weights
)

Parameters

data  Double
An array containing the data.
weights  Double
An array containing the non-negative weights.

Return Value

Double
Exceptions
ExceptionCondition
InvalidArgumentExceptionThe two lengths of the data and weights vectors must be equal.
InvalidArgumentExceptionThere must be at least one postive non-zero weight.
InvalidArgumentExceptionAll weights must be non-negative. At least one negative weight was found.
Remarks
If the lower sum of the weights is equal the weight's midpoint, then the average of the adjacent two datapoints is returned.
See Also