public void ConstructorTest2()
{
// Create a new Poisson distribution with lambda = 0.7
PoissonDistribution poisson = new PoissonDistribution(0.7);
double mean = poisson.Mean; // 0.7 (lambda)
double median = poisson.Median; // 1.0
double mode = poisson.Mode; // 0.7 (lambda)
double stdDev = poisson.StandardDeviation; // 0.836 [sqrt((lambda))]
double var = poisson.Variance; // 0.7 (lambda)
// The cumulative distribution function, or the probability that a real-valued
// random variable will be found to have a value less than or equal to some x:
double cdf = poisson.DistributionFunction(k: 1); // 0.84419501644539618
// The probability density function, or the relative likelihood for a real-valued
// random variable will be found to take on a given specific value of x:
double pdf = poisson.ProbabilityMassFunction(k: 1); // 0.34760971265398666
// The log of the probability density function, useful for applications where
// precision is critical
double lpdf = poisson.LogProbabilityMassFunction(k: 1); // -1.0566749439387324
// The complementary distribution function, or the tail function, that gives the
// probability that a real-valued random variable will be found to have a value
// greater than some x. This function is also known as the Survival function.
double ccdf = poisson.ComplementaryDistributionFunction(k: 1); // 0.15580498355460382
// The inverse distribution function, or the Quantile function, that is able to
// revert probability values back to the real value that produces that probability
int icdf = poisson.InverseDistributionFunction(p: cdf); // 1
// The Hazard function, or the failure rate, the event rate at time t conditional
// on survival until time t or later. Note that this function may only make sense
// when using time-defined distributions, such as the Poisson.
double hf = poisson.HazardFunction(x: 1); // 2.2310564445595058
// The cumulative hazard function, that gives how much the hazard
// function accumulated over time until a given time instant x.
double chf = poisson.CumulativeHazardFunction(x: 1); // 1.8591501591854034
// Every distribution has a friendly string representation
string str = poisson.ToString(System.Globalization.CultureInfo.InvariantCulture); // Poisson(x; λ = 0.7)
Assert.AreEqual(0.84419501644539618, cdf);
Assert.AreEqual(0.34760971265398666, pdf);
Assert.AreEqual(-1.0566749439387324, lpdf);
Assert.AreEqual(0.15580498355460382, ccdf);
Assert.AreEqual(1, icdf);
Assert.AreEqual(2.2310564445595058, hf);
Assert.AreEqual(1.8591501591854034, chf);
Assert.AreEqual("Poisson(x; λ = 0.7)", str);
Assert.AreEqual(0.7, mean);
Assert.AreEqual(0.7, mode);
Assert.AreEqual(1, median);
Assert.AreEqual(0.7, var);
Assert.AreEqual(0.83666002653407556, stdDev);
}