ILNumerics Ultimate VS

Statisticsvar Method (InArrayDouble, InArrayDouble, Boolean, Int32)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
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<double> var(
	InArray<double> A,
	InArray<double> Weights = null,
	bool biased = false,
	int dim = -1
)

Parameters

A
Type: ILNumericsInArrayDouble
Input array A.
Weights (Optional)
Type: ILNumericsInArrayDouble
[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: RetArrayDouble
Variances
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];
If biased is false (default) the normalization is done with the length of the working dimension of A as follows:
r = (A - mean(A)); 
            var = sum(r * r) / (A.D[dim] - 1);
If Weights is given, the parameter biased is ignored.

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

Reference