def test_cdf(self): # The high tolerance is more due to the imprecision of the test values. for sp, st, pr in lewis_values: assert isclose(ad_unif.cdf(st, sp), pr, rtol=.05) # Compared to R package "goftest" (based on the same approximation). ps = ad_unif(5).cdf((.5, 1, 2, 3)) assert allclose(ps, (.2617, .6474, .9057, .9708), rtol=.5e-3) ps = ad_unif(10).cdf((.5, 1, 2, 3)) assert allclose(ps, (.2574, .6449, .9069, .9717), rtol=.5e-3) ps = ad_unif(20).cdf((.5, 1, 2, 3)) assert allclose(ps, (.2553, .6438, .9075, .9722), rtol=.5e-3)
def test_one(self): # For n = 1, p = sqrt(1 - 4 exp(-1 - z)) or 0. ps = ad_unif(1).cdf((.1, 1, 3)) assert allclose(ps, (0, .677243580297, .962672033688), rtol=.5e-12)