ProbabilityDensityFunction() public méthode

Gets the probability density function (pdf) for the χ² distribution evaluated at point x.

The Probability Density Function (PDF) describes the probability that a given value x will occur.

public ProbabilityDensityFunction ( double x ) : double
x double
Résultat double
        public void ConstructorTest()
        {
            var invchisq = new InverseChiSquareDistribution(degreesOfFreedom: 7);

            double mean = invchisq.Mean;     // 0.2
            double median = invchisq.Median; // 6.345811068141737
            double var = invchisq.Variance;  // 75
            double mode = invchisq.Mode;     // 0.1111111111111111

            double cdf = invchisq.DistributionFunction(x: 6.27); // 0.50860033566176044
            double pdf = invchisq.ProbabilityDensityFunction(x: 6.27); // 0.0000063457380298844403
            double lpdf = invchisq.LogProbabilityDensityFunction(x: 6.27); // -11.967727146795536

            double ccdf = invchisq.ComplementaryDistributionFunction(x: 6.27); // 0.49139966433823956
            double icdf = invchisq.InverseDistributionFunction(p: cdf); // 6.2699998329362963

            double hf = invchisq.HazardFunction(x: 6.27); // 0.000012913598625327002
            double chf = invchisq.CumulativeHazardFunction(x: 6.27); // 0.71049750196765715

            string str = invchisq.ToString(); // "Inv-χ²(x; df = 7)"

            Assert.AreEqual(0.2, mean, 1e-10);
            Assert.AreEqual(6.345811068141737, median, 1e-6);
            Assert.AreEqual(75, var);
            Assert.AreEqual(0.1111111111111111, mode);
            Assert.AreEqual(0.71049750196765715, chf);
            Assert.AreEqual(0.50860033566176044, cdf);
            Assert.AreEqual(0.0000063457380298844403, pdf);
            Assert.AreEqual(-11.967727146795536, lpdf);
            Assert.AreEqual(0.000012913598625327002, hf);
            Assert.AreEqual(0.49139966433823956, ccdf);
            Assert.AreEqual(6.2699998329362963, icdf, 1e-6);
            Assert.AreEqual("Inv-χ²(x; df = 7)", str);

            var range1 = invchisq.GetRange(0.95);
            var range2 = invchisq.GetRange(0.99);
            var range3 = invchisq.GetRange(0.01);

            Assert.AreEqual(2.1673499092513264, range1.Min);
            Assert.AreEqual(14.067140449765922, range1.Max);
            Assert.AreEqual(1.2390421125300894, range2.Min);
            Assert.AreEqual(18.475307115523769, range2.Max);
            Assert.AreEqual(1.2390421125300894, range3.Min);
            Assert.AreEqual(18.475307115523773, range3.Max);
        }