ILNumerics - Technical Application Development
Assembly: ILNumerics.Toolboxes.Statistics (in ILNumerics.Toolboxes.Statistics.dll) Version: 5.5.0.0 (5.5.7503.3146)
Variances
If biased is false (default) the normalization is done with the length of the working dimension of A as follows:
If Weights is given, the parameter biased is ignored.
Calculates the variance along dimension of A.
[ILNumerics Statistics Toolbox]
Namespace: ILNumerics.Toolboxes
Assembly: ILNumerics.Toolboxes.Statistics (in ILNumerics.Toolboxes.Statistics.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax
public static RetArray<float> var( InArray<float> A, InArray<float> Weights = null, bool biased = false, int dim = -1 )
Parameters
- A
- Type: ILNumericsInArraySingle
Input array A. - Weights (Optional)
- Type: ILNumericsInArraySingle
[Optional] Vector of scaling factors, same length as working dimension of A, default: no scaling. - biased (Optional)
- Type: SystemBoolean
[Optional] true: apply biased normalization to result, default: false (non-biased). - dim (Optional)
- Type: SystemInt32
[Optional] Index of the dimension to operate along. If omitted operates along the first non singleton dimension (i.e. != 1).
Return Value
Type: RetArraySingleVariances
Remarks
On scalar A a scalar 0 of the same shape as A is returned.
On empty A an empty array is returned, having the dimension to operate along reduced to length 1.
The parameters Weights, biased and dim are optional. Ommiting either one will choose its respective default value.
The result for biased = true is computed by the following formula:
r = (A - mean(A));
var = sum(r * r) / A.D[dim];
r = (A - mean(A)); var = sum(r * r) / (A.D[dim] - 1);
If Weights is given, the normalization is applied to r as follows:
w = w / sum(w);
r = A - sum(w * A);
var = sum(w * (r * r));
[ILNumerics Statistics Toolbox]
See Also