Example #1
0
 def test_match_sas_ci(self, data_set):
     sas_ci = 0.4566, 2.1902
     ord = OddsRatio()
     ord.fit(data_set, exposure='exp', outcome='dis')
     df = ord.results
     npt.assert_allclose(df.loc[df.index == '1'][['OR_LCL', 'OR_UCL']],
                         [sas_ci],
                         rtol=1e-4)
Example #2
0
 def test_match_sas_sampledata(self):
     sas_or = 0.7036
     sas_se = 0.361479191
     sas_ci = 0.3465, 1.4290
     df = ze.load_sample_data(False)
     ord = OddsRatio()
     ord.fit(df, exposure='art', outcome='dead')
     npt.assert_allclose(ord.odds_ratio[1], sas_or, rtol=1e-4)
     rf = ord.results
     npt.assert_allclose(rf.loc[rf.index == '1'][['OR_LCL', 'OR_UCL']], [sas_ci], rtol=1e-3)
     npt.assert_allclose(rf.loc[rf.index == '1'][['SD(OR)']], sas_se, rtol=1e-4)
Example #3
0
def measures_check():
    # 7) Check measures plots
    data_set = load_sample_data(False)
    rr = RiskRatio()
    rr.fit(data_set, exposure='art', outcome='dead')
    rr.plot(fmt='*', ecolor='r', barsabove=True, markersize=25)
    plt.show()
    rd = RiskDifference()
    rd.fit(data_set, exposure='art', outcome='dead')
    rd.plot()
    plt.show()
    ord = OddsRatio()
    ord.fit(data_set, exposure='art', outcome='dead')
    ord.plot()
    plt.show()
    irr = IncidenceRateRatio()
    irr.fit(data_set, exposure='art', outcome='dead', time='t')
    irr.plot()
    plt.show()
    ird = IncidenceRateDifference()
    ird.fit(data_set, exposure='art', outcome='dead', time='t')
    ird.plot()
    plt.show()
Example #4
0
 def test_multiple_exposures(self, multi_exposures):
     ord = OddsRatio()
     ord.fit(multi_exposures, exposure='exp', outcome='dis')
     assert ord.results.shape[0] == 3
     assert list(ord.results.index) == ['Ref:0', '1', '2']
Example #5
0
 def test_odds_ratio_equal_to_1(self, data_set):
     ord = OddsRatio()
     ord.fit(data_set, exposure='exp', outcome='dis')
     assert ord.odds_ratio[1] == 1