Accord.Tests.Statistics.IndependentTest.FitTest C# (CSharp) Method

FitTest() private method

private FitTest ( ) : void
return void
        public void FitTest()
        {
            double[][] data =
            {
                new double[] { 1, 8 },
                new double[] { 2, 6 },
                new double[] { 5, 7 },
                new double[] { 3, 9 },
            };


            var p1 = new NormalDistribution(0, 1);
            var p2 = new NormalDistribution(0, 1);

            Independent<NormalDistribution> target = new Independent<NormalDistribution>(p1, p2);

            target.Fit(data);

            Assert.AreEqual(2.75, target.Mean[0]);
            Assert.AreEqual(7.50, target.Mean[1]);

            Assert.AreEqual(2.91666, target.Variance[0], 1e-5);
            Assert.AreEqual(1.66666, target.Variance[1], 1e-5);

            Assert.AreEqual(target.Variance[0], target.Covariance[0, 0]);
            Assert.AreEqual(target.Variance[1], target.Covariance[1, 1]);
            Assert.AreEqual(0, target.Covariance[0, 1]);
            Assert.AreEqual(0, target.Covariance[1, 0]);
        }