Click or drag to resize

Univariate.Variance Method

Computes the sample variance.

Namespace:  Meta.Numerics.Statistics
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
Syntax
public static double Variance(
	this IReadOnlyCollection<double> sample
)

Parameters

sample
Type: System.Collections.Generic.IReadOnlyCollection<Double>
The sample.

Return Value

Type: Double
The variance of the sample data.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IReadOnlyCollection<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).
Exceptions
ExceptionCondition
ArgumentNullExceptionsample is null.
Remarks

Note that some authors use the term "sample variance" to mean "the population variance as estimated by the sample". We do not adopt this aberrant convention, which is contrary to the conventional meanings of all other sample moments. This means that what is returned by this method is the sum of squared deviations divided by n, not divided by (n-1). If you want an estimate of the population variance, use the PopulationVariance(IReadOnlyCollection<Double> ) method.

See Also