Esempio n. 1
0
 def test_rd_of_zero_is_nnt_inf(self):
     nnt = number_needed_to_treat(25, 25, 25, 25)
     assert np.isinf(nnt[0])
Esempio n. 2
0
 def test_match_rd_se(self):
     nnt = number_needed_to_treat(50, 50, 25, 75)
     rd = risk_difference(50, 50, 25, 75)
     npt.assert_allclose(nnt.standard_error, rd[3])
Esempio n. 3
0
 def test_match_risk_difference(self):
     nnt = number_needed_to_treat(50, 50, 25, 75)
     rd = risk_difference(50, 50, 25, 75)
     npt.assert_allclose(nnt.point_estimate, 1 / rd[0])
Esempio n. 4
0
 def test_match_rd_ci(self):
     nnt = number_needed_to_treat(50, 50, 25, 75)
     rd = risk_difference(50, 50, 25, 75)
     npt.assert_allclose(nnt[1:3], [1 / i for i in rd[1:3]])
Esempio n. 5
0
 def test_value_error_for_negative_counts(self):
     with pytest.raises(ValueError):
         number_needed_to_treat(-5, 1, 1, 1)