public DistributionFunction ( double x ) : double | ||
x | double | A single point in the distribution range. |
return | double |
public void ConstructorTest1() { var sech = new HyperbolicSecantDistribution(); double mean = sech.Mean; // 0.0 double median = sech.Median; // 0.0 double mode = sech.Mode; // 0.0 double var = sech.Variance; // 1.0 double cdf = sech.DistributionFunction(x: 1.4); // 2.2939067361538474 double pdf = sech.ProbabilityDensityFunction(x: 1.4); // 0.10955386512899701 double lpdf = sech.LogProbabilityDensityFunction(x: 1.4); // -2.2113389316917877 double ccdf = sech.ComplementaryDistributionFunction(x: 1.4); // -1.2939067361538474 double icdf = sech.InverseDistributionFunction(p: cdf); // 1.4000000017042402 double hf = sech.HazardFunction(x: 1.4); // -0.084669058493850285 string str = sech.ToString(); // Sech(x) Assert.AreEqual(0, mean); Assert.AreEqual(0, median); Assert.AreEqual(1, var); Assert.AreEqual(0, mode); Assert.AreEqual(2.2939067361538474, cdf); Assert.AreEqual(0.10955386512899701, pdf); Assert.AreEqual(-2.2113389316917877, lpdf); Assert.AreEqual(-0.084669058493850285, hf); Assert.AreEqual(-1.2939067361538474, ccdf); Assert.AreEqual(1.4000000017042402, icdf, 1e-13); Assert.AreEqual("Sech(x)", str); Assert.IsFalse(double.IsNaN(icdf)); }
public void ConstructorTest1() { var sech = new HyperbolicSecantDistribution(); double mean = sech.Mean; // 0.0 double median = sech.Median; // 0.0 double mode = sech.Mode; // 0.0 double var = sech.Variance; // 1.0 double cdf = sech.DistributionFunction(x: 1.4); // 0.92968538268895873 double pdf = sech.ProbabilityDensityFunction(x: 1.4); // 0.10955386512899701 double lpdf = sech.LogProbabilityDensityFunction(x: 1.4); // -2.2113389316917877 double ccdf = sech.ComplementaryDistributionFunction(x: 1.4); // 0.070314617311041272 double icdf = sech.InverseDistributionFunction(p: cdf); // 1.4000000017042411 double hf = sech.HazardFunction(x: 1.4); // 1.5580524977385339 string str = sech.ToString(); // Sech(x) Assert.AreEqual(0, mean); Assert.AreEqual(0, median); Assert.AreEqual(1, var); Assert.AreEqual(0, mode); Assert.AreEqual(0.92968538268895873, cdf); Assert.AreEqual(0.10955386512899701, pdf); Assert.AreEqual(-2.2113389316917877, lpdf); Assert.AreEqual(1.5580524977385339, hf); Assert.AreEqual(0.070314617311041272, ccdf); Assert.AreEqual(1.4000000017042411, icdf); Assert.AreEqual("Sech(x)", str); Assert.IsFalse(double.IsNaN(icdf)); var range1 = sech.GetRange(0.95); var range2 = sech.GetRange(0.99); var range3 = sech.GetRange(0.01); Assert.AreEqual(-1.6183450347411152, range1.Min); Assert.AreEqual(1.6183450347411155, range1.Max); Assert.AreEqual(-2.6442035634463368, range2.Min); Assert.AreEqual(2.6442035634463381, range2.Max); Assert.AreEqual(-2.6442035634463372, range3.Min); Assert.AreEqual(2.6442035634463381, range3.Max); }