Exemplo n.º 1
0
 def test_transport_iptw(self, df_c):
     ipsw = IPSW(df_c,
                 exposure='A',
                 outcome='Y',
                 selection='S',
                 generalize=False)
     ipsw.sampling_model('L + W + W_sq', print_results=False)
     ipsw.treatment_model('L', print_results=False)
     ipsw.fit()
     npt.assert_allclose(ipsw.risk_difference, 0.047296, atol=1e-5)
     npt.assert_allclose(ipsw.risk_ratio, 1.1372, atol=1e-4)
Exemplo n.º 2
0
 def test_generalize_weight(self, df_c):
     ipsw = IPSW(df_c,
                 exposure='A',
                 outcome='Y',
                 selection='S',
                 generalize=True,
                 weights='weight')
     ipsw.sampling_model('L + W + W_sq', print_results=False)
     ipsw.treatment_model('L', print_results=False)
     ipsw.fit()
     npt.assert_allclose(ipsw.risk_difference, 0.055034, atol=1e-5)
     npt.assert_allclose(ipsw.risk_ratio, 1.167213, atol=1e-4)