public void Bug5886() { // the inverse CDF of the F-distribution would fail for d2 <= 2 double d1 = 1.0; double d2 = 0.1; FisherDistribution F = new FisherDistribution(d1, d2); double x1 = F.InverseLeftProbability(0.6); Console.WriteLine(x1); double P = F.LeftProbability(x1); Console.WriteLine(P); }
public void FisherInversion() { // x ~ Fisher(a,b) => 1/x ~ Fisher(b,a) FisherDistribution f = new FisherDistribution(2.3, 5.6); FisherDistribution fi = new FisherDistribution(f.DenominatorDegreesOfFreedom, f.NumeratorDegreesOfFreedom); Random rng = new Random(1); for (int i = 0; i < 10; i++) { double x = f.GetRandomValue(rng); double xi = 1.0 / x; // LeftProbability <-> RightProbability because as x increases, 1/x decreases Assert.IsTrue(TestUtilities.IsNearlyEqual(f.LeftProbability(x), fi.RightProbability(xi))); } }