public void ConstructorTest1() { var bs = new BirnbaumSaundersDistribution(shape: 0.42); double mean = bs.Mean; // 1.0882000000000001 double median = bs.Median; // 1.0 double var = bs.Variance; // 0.21529619999999997 double cdf = bs.DistributionFunction(x: 1.4); // 0.78956384911580346 double pdf = bs.ProbabilityDensityFunction(x: 1.4); // 1.3618433601225426 double lpdf = bs.LogProbabilityDensityFunction(x: 1.4); // 0.30883919386130815 double ccdf = bs.ComplementaryDistributionFunction(x: 1.4); // 0.21043615088419654 double icdf = bs.InverseDistributionFunction(p: cdf); // 2.0618330099769064 double hf = bs.HazardFunction(x: 1.4); // 6.4715276077824093 double chf = bs.CumulativeHazardFunction(x: 1.4); // 1.5585729930861034 string str = bs.ToString(CultureInfo.InvariantCulture); // BirnbaumSaunders(x; μ = 0, β = 1, γ = 0.42) Assert.AreEqual(1.0882000000000001, mean); Assert.AreEqual(1.0, median); Assert.AreEqual(0.21529619999999997, var); Assert.AreEqual(1.5585729930861034, chf); Assert.AreEqual(0.78956384911580346, cdf); Assert.AreEqual(1.3618433601225426, pdf); Assert.AreEqual(0.30883919386130815, lpdf); Assert.AreEqual(6.4715276077824093, hf); Assert.AreEqual(0.21043615088419654, ccdf); Assert.AreEqual(2.0618330099769064, icdf); Assert.AreEqual("BirnbaumSaunders(x; μ = 0, β = 1, γ = 0.42)", str); }
public void ConstructorTest1() { var bs = new BirnbaumSaundersDistribution(shape: 0.42); double mean = bs.Mean; // 1.0882000000000001 double median = bs.Median; // 1.0 double var = bs.Variance; // 0.21529619999999997 try { double mode = bs.Mode; Assert.Fail(); } catch { } double cdf = bs.DistributionFunction(x: 1.4); // 0.78956384911580346 double pdf = bs.ProbabilityDensityFunction(x: 1.4); // 1.3618433601225426 double lpdf = bs.LogProbabilityDensityFunction(x: 1.4); // 0.30883919386130815 double ccdf = bs.ComplementaryDistributionFunction(x: 1.4); // 0.21043615088419654 double icdf = bs.InverseDistributionFunction(p: cdf); // 2.0618330099769064 double hf = bs.HazardFunction(x: 1.4); // 6.4715276077824093 double chf = bs.CumulativeHazardFunction(x: 1.4); // 1.5585729930861034 string str = bs.ToString(CultureInfo.InvariantCulture); // BirnbaumSaunders(x; μ = 0, β = 1, γ = 0.42) Assert.AreEqual(1.0882000000000001, mean); Assert.AreEqual(1.0, median); Assert.AreEqual(0.21529619999999997, var); Assert.AreEqual(1.5585729930861034, chf); Assert.AreEqual(0.78956384911580346, cdf); Assert.AreEqual(1.3618433601225426, pdf); Assert.AreEqual(0.30883919386130815, lpdf); Assert.AreEqual(6.4715276077824093, hf); Assert.AreEqual(0.21043615088419654, ccdf); Assert.AreEqual(2.0618330099769064, icdf); Assert.AreEqual("BirnbaumSaunders(x; μ = 0, β = 1, γ = 0.42)", str); var range1 = bs.GetRange(0.95); var range2 = bs.GetRange(0.99); var range3 = bs.GetRange(0.01); Assert.AreEqual(0.096563470711246477, range1.Min); Assert.AreEqual(3.8243723816964965, range1.Max); Assert.AreEqual(0.0079430014187131717, range2.Min); Assert.AreEqual(5.8345020446298692, range2.Max); Assert.AreEqual(0.0079430014187131717, range3.Min); Assert.AreEqual(5.8345020446298692, range3.Max); }