public void FitWeights() { 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(); double[] weights = Matrix.Vector(sample.Length, 1.0 / sample.Length); target.Fit(sample, weights); Assert.AreEqual(7.12, target.Scale, 1e-6); Assert.AreEqual(2.0, target.Alpha, 1e-2); }
public void MedianTest() { var target = new ParetoDistribution(scale: 7.12, shape: 2); Assert.AreEqual(target.Median, target.InverseDistributionFunction(0.5), 1e-6); }