Stats.Weighted Mean Method
Definition
Namespace: Extreme.Statistics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
Overload List
Weighted | Returns the mean of the variable with observations weighted by the specified vector. |
Weighted | Returns the mean of the variable with observations weighted by the specified vector. |
WeightedMean(Vector<Double>, Vector<Double>)
Returns the mean of the variable with observations weighted by the specified vector.
public static double WeightedMean(
this Vector<double> values,
Vector<double> weights
)
Parameters
- values Vector<Double>
- A vector containing the data.
- weights Vector<Double>
- A vector containing the weights. May be null.
Return Value
DoubleThe mean of the variable weighted by weights.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Remarks
If weights is null, the unweighted mean is returned.
Exceptions
ArgumentNullException | values is null. |
Dimension | The length of weights does not equal the number of observations of the variable. |
WeightedMean<T>(Vector<T>, Vector<T>)
Returns the mean of the variable with observations weighted by the specified vector.
public static double WeightedMean<T>(
this Vector<T> values,
Vector<T> weights
)
Parameters
- values Vector<T>
- A vector containing the data.
- weights Vector<T>
- A vector containing the weights. May be null.
Type Parameters
- T
Return Value
DoubleThe mean of the variable weighted by weights.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Remarks
If weights is null, the unweighted mean is returned.
Exceptions
ArgumentNullException | values is null. |
Dimension | The length of weights does not equal the number of observations of the variable. |