Stats.Weighted Standard Deviation Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.9.0
Overload List
| Weighted | Returns the standard deviation of the variable with observations weighted by the specified vector. |
| Weighted | Returns the standard deviation of the array with observations weighted by the specified array. |
| Weighted | Returns the standard deviation of the variable with observations weighted by the specified vector. |
WeightedStandardDeviation<T>(Vector<T>, Vector<T>)
public static double WeightedStandardDeviation<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 standard deviation 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
The result uses total weight as the variance denominator. If weights is null, the sample standard deviation is returned. Constant weights follow the same weighted definition and length validation as other representations.
Exceptions
| Argument | values is null. |
| Dimension | The length of weights does not equal the number of observations of the variable. |
WeightedStandardDeviation<T>(T[], T[], Boolean)
public static double WeightedStandardDeviation<T>(
this T[] values,
T[] weights,
bool skipMissingValues = false
)
Parameters
- values T[]
- An array containing the data.
- weights T[]
- An array containing the weights.
- skipMissingValues Boolean (Optional)
- Optional. Specifies whether missing values should be excluded from the calculation. The default is false.
Type Parameters
- T
Return Value
DoubleThe standard deviation 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 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
The result uses total weight as the variance denominator. If weights is null, the sample standard deviation is returned, honoring skipMissingValues.
Exceptions
| Argument | values is null. |
| Dimension | The length of weights does not equal the number of observations of the variable. |
WeightedStandardDeviation<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean)
public static double WeightedStandardDeviation<T>(
this ReadOnlySpan<T> values,
ReadOnlySpan<T> weights,
bool skipMissingValues
)
Parameters
- values ReadOnlySpan<T>
- A span containing the data.
- weights ReadOnlySpan<T>
- A span containing the weights.
- skipMissingValues Boolean
- Optional. Specifies whether missing values should be excluded from the calculation. The default is false.
Type Parameters
- T
Return Value
DoubleThe standard deviation 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 ReadOnlySpan<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
The result is the square root of the weighted centered sum of squares divided by the total weight. Zero total weight returns NaN.
Exceptions
| Dimension | The length of weights does not equal the number of observations of the variable. |