public void VarianceTest8()
{
double[,] matrix =
{
{ 4.0, 2.0, 0.60 },
{ 4.2, 2.1, 0.59 },
{ 3.9, 2.0, 0.58 },
{ 4.3, 2.1, 0.62 },
{ 4.1, 2.2, 0.63 }
};
double[] weights = { 0.9, 0.9, 0.9, 0.9, 0.9 };
double[] expected =
{
Measures.WeightedVariance(matrix.GetColumn(0), weights, WeightType.Automatic),
Measures.WeightedVariance(matrix.GetColumn(1), weights, WeightType.Automatic),
Measures.WeightedVariance(matrix.GetColumn(2), weights, WeightType.Automatic),
};
double[] actual = Measures.WeightedVariance(matrix, weights, WeightType.Automatic);
Assert.IsTrue(Matrix.IsEqual(expected, actual, 1e-10));
}