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

FitTest() private method

private FitTest ( ) : void
return void
        public void FitTest()
        {
            var source = new ParetoDistribution(scale: 7.12, shape: 2);
            var sample = new double[10000];
            var step = 1.0 / sample.Length;

            for (var i = 0; i < sample.Length; i++)
                sample[i] = source.InverseDistributionFunction(i * step);

            var target = new ParetoDistribution();
            target.Fit(sample);

            Assert.AreEqual(7.12, target.Scale, 1e-6);
            Assert.AreEqual(2.0, target.Alpha, 1e-2);
        }