def test_isf(self):
     "Try the isf for the pearson3 distribution"
     quantiles = (0.001, 0.250000001, 0.50, 0.999)
     (g, m, s) = (1., 0., 1.)
     qtl = pearson3(g, m, s).isf(quantiles)
     assert_almost_equal(pearson3(g, m, s).sf(qtl), quantiles)
     (g, m, s) = (-1., 0., 1.)
     qtl = pearson3(g, m, s).isf(quantiles)
     assert_almost_equal(pearson3(g, m, s).sf(qtl), quantiles)
     (g, m, s) = (-1., -1., 0.5)
     qtl = pearson3(g, m, s).isf(quantiles)
     assert_almost_equal(pearson3(g, m, s).sf(qtl), quantiles)
     (g, m, s) = (+np.pi, 0., +np.pi)
     qtl = pearson3(g, m, s).isf(quantiles)
     assert_almost_equal(pearson3(g, m, s).sf(qtl), quantiles)
     (g, m, s) = (-np.pi, 0., +np.pi)
     qtl = pearson3(g, m, s).isf(quantiles)
     assert_almost_equal(pearson3(g, m, s).sf(qtl), quantiles)
 def test_cdf_normal_case(self):
     (g, m, s) = (0., 0., 1.)
     assert_almost_equal(
         pearson3(g).cdf([0., .25, .5, 1.]),
         dist.norm().cdf([0., .25, .5, 1.]))
     assert_almost_equal(
         pearson3(g).pdf([0., .25, .5, 1.]),
         dist.norm().pdf([0., .25, .5, 1.]))
     assert_almost_equal(
         pearson3(g).ppf([0.001, 0.25, 0.50, 0.999]),
         dist.norm().ppf([0.001, 0.25, 0.50, 0.999]),
     )
     assert_almost_equal(
         pearson3(g).sf([0., .25, .5, 1.]),
         dist.norm().sf([0., .25, .5, 1.]))
     assert_almost_equal(
         pearson3(g).isf([0.001, 0.25, 0.50, 0.999]),
         dist.norm().isf([0.001, 0.25, 0.50, 0.999]))
 def test_cdf(self):
     "Try the cdf for the pearson3 distribution"
     (g, m, s) = (1., 0., 1.)
     assert_almost_equal(
         pearson3(g).cdf([0., .25, .5, 1.]),
         [0.5665299, 0.6577040, 0.7349741, 0.8487961])
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         [0.5665299, 0.6577040, 0.7349741, 0.8487961])
     (g, m, s) = (-1., 0., 1.)
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         [0.4334701, 0.5366327, 0.6472319, 0.8571235])
     (g, m, s) = (-1., -1., 0.5)
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         [1.000000, 1.000000, 1.000000, 1.000000], 6)
     (g, m, s) = (+np.pi, 0., +np.pi)
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         [0.7003103, 0.7251716, 0.7472890, 0.7849331], 6)
     (g, m, s) = (-np.pi, 0., +np.pi)
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         [0.2996897, 0.3278695, 0.3601563, 0.4422018], 6)
 def test_pdf(self):
     "Try the pdf for the pearson3 distribution"
     (g, m, s) = (1., 0., 1.)
     assert_almost_equal(
         pearson3(g).pdf([0., .25, .5, 1.]),
         [0.3907336, 0.3374358, 0.2807478, 0.1784702])
     assert_almost_equal(
         pearson3(g, m, s).pdf([0., .25, .5, 1.]),
         [0.3907336, 0.3374358, 0.2807478, 0.1784702])
     (g, m, s) = (-1., 0., 1.)
     assert_almost_equal(
         pearson3(g, m, s).pdf([0., .25, .5, 1.]),
         [0.3907336, 0.4315709, 0.4480836, 0.3608941])
     (g, m, s) = (-1., -1., 0.5)
     assert_almost_equal(
         pearson3(g, m, s).pdf([0., .25, .5, 1.]),
         [0.000000, -1.812188, -39.408299, -2329.521068], 6)
     (g, m, s) = (+np.pi, 0., +np.pi)
     assert_almost_equal(
         pearson3(g, m, s).pdf([0., .25, .5, 1.]),
         [0.10564050, 0.09362841, 0.08359751, 0.06777973], 6)
     (g, m, s) = (-np.pi, 0., +np.pi)
     assert_almost_equal(
         pearson3(g, m, s).pdf([0., .25, .5, 1.]),
         [0.1056405, 0.1203153, 0.1387192, 0.1953728], 6)
 def test_sf(self):
     "Try the sf for the pearson3 distribution"
     (g, m, s) = (1., 0., 1.)
     assert_almost_equal(
         pearson3(g).sf([0., .25, .5, 1.]),
         1. - pearson3(g).cdf([0., .25, .5, 1.]))
     (g, m, s) = (-1., 0., 1.)
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         1. - pearson3(g, m, s).sf([0., .25, .5, 1.]))
     (g, m, s) = (-1., -1., 0.5)
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         1. - pearson3(g, m, s).sf([0., .25, .5, 1.]), 6)
     (g, m, s) = (+np.pi, 0., +np.pi)
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         1. - pearson3(g, m, s).sf([0., .25, .5, 1.]), 6)
     (g, m, s) = (-np.pi, 0., +np.pi)
     assert_almost_equal(
         pearson3(g, m, s).cdf([0., .25, .5, 1.]),
         1. - pearson3(g, m, s).sf([0., .25, .5, 1.]), 6)
 def test_ppf(self):
     "Try the ppf for the pearson3 distribution"
     quantiles = (0.001, 0.250000001, 0.50, 0.999)
     (g, m, s) = (1., 0., 1.)
     assert_almost_equal(
         pearson3(g).ppf(quantiles),
         [-1.7857238, -0.7323399, -0.1639696, 4.5311204])
     assert_almost_equal(
         pearson3(g, m, s).ppf(quantiles),
         [-1.7857238, -0.7323399, -0.1639696, 4.5311204])
     qtl = pearson3(g, m, s).ppf(quantiles)
     assert_almost_equal(pearson3(g, m, s).cdf(qtl), quantiles)
     (g, m, s) = (-1., 0., 1.)
     assert_almost_equal(
         pearson3(g, m, s).ppf(quantiles),
         [-4.5311204, -0.5547137, 0.1639696, 1.7857238])
     qtl = pearson3(g, m, s).ppf(quantiles)
     assert_almost_equal(pearson3(g, m, s).cdf(qtl), quantiles)
     (g, m, s) = (-1., -1., 0.5)
     assert_almost_equal(
         pearson3(g, m, s).ppf(quantiles),
         [-3.2655602, -1.2773569, -0.9180152, -0.1071381], 6)
     qtl = pearson3(g, m, s).ppf(quantiles)
     assert_almost_equal(pearson3(g, m, s).cdf(qtl), quantiles)
     (g, m, s) = (+np.pi, 0., +np.pi)
     assert_almost_equal(
         pearson3(g, m, s).ppf(quantiles),
         [-2.000000, -1.877859, -1.263601, 22.986482], 6)
     qtl = pearson3(g, m, s).ppf(quantiles)
     assert_almost_equal(pearson3(g, m, s).cdf(qtl), quantiles)
     (g, m, s) = (-np.pi, 0., +np.pi)
     assert_almost_equal(
         pearson3(g, m, s).ppf(quantiles),
         [-22.9864825, -0.5326628, 1.2636014, 1.9999999], 6)
     qtl = pearson3(g, m, s).ppf(quantiles)
     assert_almost_equal(pearson3(g, m, s).cdf(qtl), quantiles)