def test_maxlikelihood(self): ''' Test function of Maximum Likelihood Estimate. ''' def probfn(prob): return prob fn = ts.likelihood(probfn, self.estimates, log=True) dfn = cl.diffn(fn) chk = 7/10
def test_likelihood_log(self): ''' Logarithm likelihood function test. ''' def chkfn(p): return 7*math.log(p)+3*math.log(1-p) def probfn(prob): return prob resfn = ts.likelihood(probfn, self.estimates, log=True) testp = 1/2 res = resfn(testp) chk = chkfn(testp) self.assertEqual(res, chk)
def test_likelihood(self): ''' Likelihood test function. ''' def chkfn(p): return p**7*(1-p)**3 def probfn(prob): return prob resfn = ts.likelihood(probfn, self.estimates, log=False) testp = 1/3 res = resfn(testp) chk = chkfn(testp) self.assertEqual(res, chk)