Example #1
0
        private static void testGompertz(GeneralContinuousDistribution gompertz)
        {
            double median = gompertz.Median;                                   // 0.13886469671401389

            double cdf  = gompertz.DistributionFunction(x: 0.27);              // 0.76599768199799145
            double pdf  = gompertz.ProbabilityDensityFunction(x: 0.27);        // 1.4549484164912097
            double lpdf = gompertz.LogProbabilityDensityFunction(x: 0.27);     // 0.37497044741163688

            double ccdf = gompertz.ComplementaryDistributionFunction(x: 0.27); // 0.23400231800200855
            double icdf = gompertz.InverseDistributionFunction(p: cdf);        // 0.26999999999766749

            double hf  = gompertz.HazardFunction(x: 0.27);                     // 6.2176666834502088
            double chf = gompertz.CumulativeHazardFunction(x: 0.27);           // 1.4524242576820101

            Assert.AreEqual(0.13886469671401389, median, 1e-6);
            Assert.AreEqual(1.4524242576820101, chf, 1e-5);
            Assert.AreEqual(0.76599768199799145, cdf, 1e-5);
            Assert.AreEqual(1.4549484164912097, pdf, 1e-6);
            Assert.AreEqual(0.37497044741163688, lpdf, 1e-6);
            Assert.AreEqual(6.2176666834502088, hf, 1e-4);
            Assert.AreEqual(0.23400231800200855, ccdf, 1e-5);
            Assert.AreEqual(0.26999999999766749, icdf, 1e-5);
        }