def test_ajf_plotting_with_add_count_at_risk(self, block): E = [0, 1, 1, 2, 2, 0] T = [1, 2, 3, 4, 5, 6] ajf = AalenJohansenFitter().fit(T, E, event_of_interest=1) ajf.plot(at_risk_counts=True) self.plt.title("test_ajf_plotting_with_add_count_at_risk") self.plt.show(block=block) return
def test_ajf_plotting(self, block): E = [0, 1, 1, 2, 2, 0] T = [1, 2, 3, 4, 5, 6] ajf = AalenJohansenFitter().fit(T, E, event_of_interest=1) ajf.plot() self.plt.title("test_ajf_plotting") self.plt.show(block=block) return
def test_ajf_plotting_no_confidence_intervals(self, block): E = [0, 1, 1, 2, 2, 0] T = [1, 2, 3, 4, 5, 6] ajf = AalenJohansenFitter(calculate_variance=False).fit(T, E, event_of_interest=1) ajf.plot(ci_show=False) self.plt.title("test_ajf_plotting_no_confidence_intervals") self.plt.show(block=block) return
status2 = 'death_wl' # options: 'death_ld', 'death_dec', 'death_wl' wl_rows = ['WL_profit', 'Death_profit', 'WL_nonprofit', 'Death_nonprofit'] dec_rows = ['DDKT_profit', 'Death_profit', 'DDKT_nonprofit', 'Death_nonprofit'] ld_rows = ['LDKT_profit', 'Death_profit', 'LDKT_nonprofit', 'Death_nonprofit'] rows = wl_rows title = 'Cumulative incidence of waitlisting \n by facility profit status' output = 'output\\cif_wl.png' cif = pd.read_csv('Data\\Fortable3mi_ld_dec_censored.csv') cif.loc[cif['death_wl'] == 1, 'wlist'] = 2 cif.loc[cif['death_dec'] == 1, 'dec'] = 2 cif.loc[cif['death_ld'] == 1, 'ldtx'] = 2 cif_p = cif[cif.for_profit == 1] cif_np = cif[cif.for_profit == 0] ajf1 = AalenJohansenFitter(calculate_variance=False) ajf1.fit(cif_p[time] / 12, cif_p[status1], 1) ajf2 = AalenJohansenFitter(calculate_variance=False) ajf2.fit(cif_np[time] / 12, cif_np[status1], 1) ajf3 = AalenJohansenFitter(calculate_variance=False) ajf3.fit(cif_p[time] / 12, cif_p[status2], 1) ajf4 = AalenJohansenFitter(calculate_variance=False) ajf4.fit(cif_np[time] / 12, cif_np[status2], 1) status1_p = [ float(ajf1.cumulative_density_.loc[slice(2 * i)].tail(1).values.round(3)) for i in range(0, 6) ] status1_np = [ float(ajf2.cumulative_density_.loc[slice(2 * i)].tail(1).values.round(3)) for i in range(0, 6) ]