def test_compute_lrt_fails_when_garbage_goes_in(self): pe = ParameterEstimation() t0 = [2.0] with pytest.raises(TypeError): pe.compute_lrt(self.lpost, t0, None, t0) with pytest.raises(ValueError): pe.compute_lrt(self.lpost, t0[:-1], self.lpost, t0)
def test_compute_lrt_computes_deviance_correctly(self): t0 = [2.0] pe = ParameterEstimation() delta_deviance = pe.compute_lrt(self.lpost, t0, self.lpost, t0) assert delta_deviance < 1e-7
def test_compute_lrt_sets_max_post_to_false(self): t0 = [2.0] pe = ParameterEstimation(max_post=True) assert pe.max_post is True delta_deviance = pe.compute_lrt(self.lpost, t0, self.lpost, t0) assert pe.max_post is False
def test_compute_lrt_computes_deviance_correctly(self): t0 = [2.0] pe = ParameterEstimation() delta_deviance, opt1, opt2 = pe.compute_lrt(self.lpost, t0, self.lpost, t0) assert delta_deviance < 1e-7