def test_ppf(self):
     "Test the PPF of the Kappa distribution"
     (k, h) = (1., 1.)
     control = (0.01, 0.25, 0.5, 0.99)
     assert_almost_equal(kappa.ppf([0.01, 0.25, 0.5, 0.99], k, h), control)
     assert_almost_equal(kappa(k, h).ppf([0.01, 0.25, 0.5, 0.99]), control)
     (k, h) = (0.1, 1.)
     control = [0.01004529, 0.28358342, 0.669670085, 3.69042656]
     assert_almost_equal(kappa.ppf([0.01, 0.25, 0.5, 0.99], k, h), control)
     assert_almost_equal(kappa(k, h).ppf([0.01, 0.25, 0.5, 0.99]), control)
     (k, h) = (1., 0.1)
     control = [-2.6904266, -0.29449437, 0.33032992, 0.9899547]
     assert_almost_equal(kappa(k, h).ppf([0.01, 0.25, 0.5, 0.99]), control)
 def test_ppf(self):
     "Test the PPF of the Kappa distribution"
     (k, h) = (1., 1.)
     control = (0.01, 0.25, 0.5, 0.99)
     assert_almost_equal(kappa.ppf([0.01, 0.25, 0.5, 0.99], k, h), control)
     assert_almost_equal(kappa(k, h).ppf([0.01, 0.25, 0.5, 0.99]), control)
     (k, h) = (0.1, 1.)
     control = [0.01004529, 0.28358342, 0.669670085, 3.69042656]
     assert_almost_equal(kappa.ppf([0.01, 0.25, 0.5, 0.99], k, h), control)
     assert_almost_equal(kappa(k, h).ppf([0.01, 0.25, 0.5, 0.99]), control)
     (k, h) = (1., 0.1)
     control = [-2.6904266, -0.29449437, 0.33032992, 0.9899547]
     assert_almost_equal(kappa(k, h).ppf([0.01, 0.25, 0.5, 0.99]), control)
 def test_lmparams_kappa(self):
     "Test parameter estimation from L_moments for the Wakeby distribution"
     (loc, scale, h, k) = (0.0, 1.0,  1.0, 1.0)
     lmoms = kappa(h, k, loc, scale).lstats(4)
     assert_almost_equal(kappa.lmparams(lmoms),
                         np.array((loc, scale, h, k)), 6)
     (loc, scale, h, k) = (0.0, 0.5, -0.5, 0.99)
     lmoms = kappa(h, k, loc, scale).lstats(4)
     assert_almost_equal(kappa.lmparams(lmoms),
                         np.array((loc, scale, h, k)), 6)
     (loc, scale, h, k) = (0.5, 2.0, 1.0, 0.5)
     lmoms = kappa(h, k, loc, scale).lstats(4)
     assert_almost_equal(kappa.lmparams(lmoms),
                         np.array((loc, scale, h, k)), 6)
     (loc, scale, h, k) = (0.0, 2.0,  0.5, 0.99)
     lmoms = kappa(h, k, loc, scale).lstats(4)
     assert_almost_equal(kappa.lmparams(lmoms),
                         np.array((loc, scale, h, k)), 6)
 def test_cdf(self):
     "Test the CDF of the Kappa distribution"
     (k, h) = (1., 1.)
     control = (0., 0.25, 0.5, 1.)
     assert_almost_equal(kappa.cdf([0., 0.25, 0.5, 1.], k, h), control)
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
     (k, h) = (0.1, 1.)
     control = [0.0, 0.22367038, 0.401263061, 0.65132156]
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
     (k, h) = (1., 0.1)
     control = [0.34867844, 0.45858234, 0.59873694, 1.0]
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
     (k, h) = (0.5, 1.)
     control = [0, 0.234375, 0.4375, 0.75]
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
     (k, h) = (0., 1.)
     control = [0., 0.221199217, 0.393469340, 0.63212055883]
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
 def test_lmparams_kappa(self):
     "Test parameter estimation from L_moments for the Wakeby distribution"
     (loc, scale, h, k) = (0.0, 1.0, 1.0, 1.0)
     lmoms = kappa(h, k, loc, scale).lstats(4)
     assert_almost_equal(kappa.lmparams(lmoms), np.array(
         (loc, scale, h, k)), 6)
     (loc, scale, h, k) = (0.0, 0.5, -0.5, 0.99)
     lmoms = kappa(h, k, loc, scale).lstats(4)
     assert_almost_equal(kappa.lmparams(lmoms), np.array(
         (loc, scale, h, k)), 6)
     (loc, scale, h, k) = (0.5, 2.0, 1.0, 0.5)
     lmoms = kappa(h, k, loc, scale).lstats(4)
     assert_almost_equal(kappa.lmparams(lmoms), np.array(
         (loc, scale, h, k)), 6)
     (loc, scale, h, k) = (0.0, 2.0, 0.5, 0.99)
     lmoms = kappa(h, k, loc, scale).lstats(4)
     assert_almost_equal(kappa.lmparams(lmoms), np.array(
         (loc, scale, h, k)), 6)
 def test_cdf(self):
     "Test the CDF of the Kappa distribution"
     (k, h) = (1., 1.)
     control = (0., 0.25, 0.5, 1.)
     assert_almost_equal(kappa.cdf([0., 0.25, 0.5, 1.], k, h), control)
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
     (k, h) = (0.1, 1.)
     control = [0.0, 0.22367038, 0.401263061, 0.65132156]
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
     (k, h) = (1., 0.1)
     control = [0.34867844, 0.45858234, 0.59873694, 1.0]
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
     (k, h) = (0.5, 1.)
     control = [0, 0.234375, 0.4375, 0.75]
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)
     (k, h) = (0., 1.)
     control = [0., 0.221199217, 0.393469340, 0.63212055883]
     assert_almost_equal(kappa(k, h).cdf([0., 0.25, 0.5, 1.]), control)