Пример #1
0
                            1 - d2.cdf(xx),
                            err_msg='cdf' + d1.name)
        assert_almost_equal(d1.pdf(nxx), d2.pdf(xx))
        assert_almost_equal(d1.sf(nxx), 1 - d2.sf(xx))
        assert_almost_equal(d1.ppf(ppfq), -d2.ppf(ppfq)[::-1])
        assert_almost_equal(d1.isf(ppfq), -d2.isf(ppfq)[::-1])
        assert_almost_equal(d1.moment(3), -d2.moment(3))
        ch2oddneg = [
            v * (-1)**(i + 1) for i, v in enumerate(d2.stats(moments='mvsk'))
        ]
        assert_almost_equal(d1.stats(moments='mvsk'),
                            ch2oddneg,
                            err_msg='stats ' + d1.name + d2.name)


if __name__ == '__main__':
    tt = Test_Transf2()
    tt.test_equivalent()
    tt.test_equivalent_negsq()

    debug = 0
    if debug:
        print(negsquarenormalg.ppf([0.1, 0.5, 0.9]))
        print(stats.chi2.ppf([0.1, 0.5, 0.9], 1))
        print(negsquarenormalg.a)
        print(negsquarenormalg.b)

        print(absnormalg.stats(moments='mvsk'))
        print(stats.foldnorm(1e-10).stats(moments='mvsk'))
        print(stats.halfnorm.stats(moments='mvsk'))
Пример #2
0
        xx, nxx, ppfq = self.xx, self.nxx, self.ppfq
        d1,d2 = (negsquarenormalg, stats.chi2(1))
        #print d1.name
        assert_almost_equal(d1.cdf(nxx), 1-d2.cdf(xx), err_msg='cdf'+d1.name)
        assert_almost_equal(d1.pdf(nxx), d2.pdf(xx))
        assert_almost_equal(d1.sf(nxx), 1-d2.sf(xx))
        assert_almost_equal(d1.ppf(ppfq), -d2.ppf(ppfq)[::-1])
        assert_almost_equal(d1.isf(ppfq), -d2.isf(ppfq)[::-1])
        assert_almost_equal(d1.moment(3), -d2.moment(3))
        ch2oddneg = [v*(-1)**(i+1) for i,v in
                     enumerate(d2.stats(moments='mvsk'))]
        assert_almost_equal(d1.stats(moments='mvsk'), ch2oddneg,
                            err_msg='stats '+d1.name+d2.name)


if __name__ == '__main__':
    tt = Test_Transf2()
    tt.test_equivalent()
    tt.test_equivalent_negsq()

    debug = 0
    if debug:
        print(negsquarenormalg.ppf([0.1,0.5,0.9]))
        print(stats.chi2.ppf([0.1,0.5,0.9],1))
        print(negsquarenormalg.a)
        print(negsquarenormalg.b)

        print(absnormalg.stats( moments='mvsk'))
        print(stats.foldnorm(1e-10).stats( moments='mvsk'))
        print(stats.halfnorm.stats( moments='mvsk'))