def report_CEA_CBA(sim_outcomes_none, sim_outcomes_anticoag): """ performs cost-effectiveness and cost-benefit analyses :param sim_outcomes_none: outcomes of a cohort simulated under no therapy :param sim_outcomes_anticoag: outcomes of a cohort simulated under anticoagultation therapy """ # define two strategies no_therapy_strategy = Econ.Strategy( name='No Therapy', cost_obs=sim_outcomes_none.costs, effect_obs=sim_outcomes_none.utilities, color='red' ) anticoag_therapy_strategy = Econ.Strategy( name='Anticoagulation Therapy', cost_obs=sim_outcomes_anticoag.costs, effect_obs=sim_outcomes_anticoag.utilities, color='blue' ) # do cost-effectiveness analysis # (the first strategy in the list of strategies is assumed to be the 'Base' strategy) CEA = Econ.CEA( strategies=[no_therapy_strategy, anticoag_therapy_strategy], if_paired=False ) # plot cost-effectiveness figure CEA.plot_CE_plane( title='Cost-Effectiveness Analysis', x_label='Additional QALYs', y_label='Additional Cost', x_range=(-0.6, 1.5), y_range=(-5000, 50000), interval_type='c' ) # report the CE table CEA.build_CE_table( interval_type='c', alpha=D.ALPHA, cost_digits=0, effect_digits=2, icer_digits=2) # cost-benefit analysis CBA = Econ.CBA( strategies=[no_therapy_strategy, anticoag_therapy_strategy], wtp_range=[0, 100000], if_paired=False ) # show the net monetary benefit figure CBA.plot_incremental_nmbs( title='Cost-Benefit Analysis', x_label='Willingness-to-pay per QALY ($)', y_label='Incremental Net Monetary Benefit ($)', interval_type='c', show_legend=True, figure_size=(6, 5) )
def report_CEA_CBA(multi_cohort_outcomes_mono, multi_cohort_outcomes_combo): """ performs cost-effectiveness and cost-benefit analyses :param multi_cohort_outcomes_mono: outcomes of a multi-cohort simulated under mono therapy :param multi_cohort_outcomes_combo: outcomes of a multi-cohort simulated under combination therapy """ # define two strategies mono_therapy_strategy = Econ.Strategy( name='Mono Therapy', cost_obs=multi_cohort_outcomes_mono.meanCosts, effect_obs=multi_cohort_outcomes_mono.meanQALYs, color='green') combo_therapy_strategy = Econ.Strategy( name='Combination Therapy', cost_obs=multi_cohort_outcomes_combo.meanCosts, effect_obs=multi_cohort_outcomes_combo.meanQALYs, color='blue') # do CEA CEA = Econ.CEA(strategies=[mono_therapy_strategy, combo_therapy_strategy], if_paired=True) # show the cost-effectiveness plane CEA.plot_CE_plane(title='Cost-Effectiveness Analysis', x_label='Additional Discounted QALY', y_label='Additional Discounted Cost', fig_size=(6, 5), add_clouds=True, transparency=0.2) # report the CE table CEA.build_CE_table( interval_type='p', # uncertainty (projection) interval alpha=D.ALPHA, cost_digits=0, effect_digits=2, icer_digits=2, file_name='CETable.csv') # CBA NBA = Econ.CBA(strategies=[mono_therapy_strategy, combo_therapy_strategy], wtp_range=(0, 50000), if_paired=True) # show the net monetary benefit figure NBA.plot_incremental_nmbs( title='Cost-Benefit Analysis', x_label='Willingness-To-Pay for One Additional QALY ($)', y_label='Incremental Net Monetary Benefit ($)', interval_type='p', show_legend=True, figure_size=(6, 5), )
def report_CEA_CBA(sim_outcomes_none, sim_outcomes_anti): """ performs cost-effectiveness and cost-benefit analyses :param sim_outcomes_mono: outcomes of a cohort simulated under mono therapy :param sim_outcomes_combo: outcomes of a cohort simulated under combination therapy """ # define two strategies no_therapy_strategy = Econ.Strategy(name='No Anticoagulation ', cost_obs=sim_outcomes_none.costs, effect_obs=sim_outcomes_none.utilities, color='green') anti_therapy_strategy = Econ.Strategy( name='With Anticoagulation', cost_obs=sim_outcomes_anti.costs, effect_obs=sim_outcomes_anti.utilities, color='blue') # do CEA CEA = Econ.CEA(strategies=[no_therapy_strategy, anti_therapy_strategy], if_paired=False) # plot cost-effectiveness figure CEA.plot_CE_plane(title='Cost-Effectiveness Analysis', x_label='Additional QALYs', y_label='Additional Cost', interval_type='c', x_range=(-0.5, 1), y_range=(-1000, 10000)) # report the CE table CEA.build_CE_table(interval_type='c', alpha=D.ALPHA, cost_digits=0, effect_digits=2, icer_digits=2, file_name='CETable.csv') # CBA NBA = Econ.CBA(strategies=[no_therapy_strategy, anti_therapy_strategy], wtp_range=[0, 50000], if_paired=False) # show the net monetary benefit figure NBA.plot_incremental_nmbs(title='Cost-Benefit Analysis', x_label='Willingness-to-pay per QALY ($)', y_label='Incremental Net Monetary Benefit ($)', interval_type='c', show_legend=True, figure_size=(6, 5))
def build_CE_curve(self, save_cea_results=False, interval_type='n', effect_multiplier=1, cost_multiplier=1, switch_cost_effect_on_figure=False, wtp_range=None): # cost-effectiveness analysis self.CEA = Econ.CEA(self.strategies, if_paired=True, health_measure='d') # CBA if wtp_range is not None: self.CBA = Econ.CBA(self.strategies, wtp_range=wtp_range, if_paired=True, health_measure='d') # if to save the results of the CEA if save_cea_results: self.CEA.build_CE_table(interval_type=interval_type, file_name='CEA Table-' + self.name + '.csv', cost_multiplier=cost_multiplier, effect_multiplier=effect_multiplier, effect_digits=0) # if the CE frontier should be calculated if self.ifFindFrontier: # find the (x, y)'s of strategies on the frontier for idx, strategy in enumerate( self.CEA.get_strategies_on_frontier()): if switch_cost_effect_on_figure: self.frontierXValues.append(strategy.dCost.get_mean() * cost_multiplier) self.frontierYValues.append(strategy.dEffect.get_mean() * effect_multiplier) else: self.frontierXValues.append(strategy.dEffect.get_mean() * effect_multiplier) self.frontierYValues.append(strategy.dCost.get_mean() * cost_multiplier) self.frontierLabels.append(strategy.name) if interval_type != 'n': effect_interval = strategy.dEffect.get_interval( interval_type=interval_type, alpha=ALPHA, multiplier=effect_multiplier) cost_interval = strategy.dCost.get_interval( interval_type=interval_type, alpha=ALPHA, multiplier=effect_multiplier) if switch_cost_effect_on_figure: self.frontierYIntervals.append(effect_interval) self.frontierXIntervals.append(cost_interval) else: self.frontierXIntervals.append(effect_interval) self.frontierYIntervals.append(cost_interval) #else: # the CE frontier needs not to be calculated # find the (x, y) values of strategies to display on CE plane # remove the base strategy if not self.xyLabelsProvided: self.xyLabels = [] for strategy in [s for s in self.CEA.strategies if s.idx > 0]: if switch_cost_effect_on_figure: self.allDeltaEffects = np.append( self.allDeltaEffects, strategy.dEffectObs * effect_multiplier) self.allDeltaCosts = np.append( self.allDeltaCosts, strategy.dCostObs * cost_multiplier) self.xValues.append(strategy.dCost.get_mean() * cost_multiplier) self.yValues.append(strategy.dEffect.get_mean() * effect_multiplier) self.xValuesByScenario.append(strategy.dCostObs * cost_multiplier) self.yValuesByScenario.append(strategy.dEffectObs * effect_multiplier) else: self.allDeltaEffects = np.append( self.allDeltaEffects, strategy.effectObs * effect_multiplier) self.allDeltaCosts = np.append( self.allDeltaCosts, strategy.costObs * cost_multiplier) self.xValues.append(strategy.dEffect.get_mean() * effect_multiplier) self.yValues.append(strategy.dCost.get_mean() * cost_multiplier) self.xValuesByScenario.append(strategy.dEffectObs * effect_multiplier) self.yValuesByScenario.append(strategy.dCostObs * cost_multiplier) if not self.xyLabelsProvided: self.xyLabels.append(strategy.label) if interval_type != 'n': effect_interval = strategy.dEffect.get_interval( interval_type=interval_type, alpha=ALPHA, multiplier=effect_multiplier) cost_interval = strategy.dCost.get_interval( interval_type=interval_type, alpha=ALPHA, multiplier=cost_multiplier) # print(strategy.name, cost_interval, effect_interval) if switch_cost_effect_on_figure: self.yIntervals.append(effect_interval) self.xIntervals.append(cost_interval) else: self.xIntervals.append(effect_interval) self.yIntervals.append(cost_interval)
s_center[0, 0] + np.random.normal(0, 1000, N), s_center[0, 1] + np.random.normal(0, 0.01, N), color='red') s1 = ce.Strategy("s1", s_center[1, 0] + np.random.normal(0, 1000, N), s_center[1, 1] + np.random.normal(0, 0.01, N), color='blue') s2 = ce.Strategy("s2", s_center[2, 0] + np.random.normal(0, 1000, N), s_center[2, 1] + np.random.normal(0, 0.05, N), color='green') cea = ce.CEA([s0, s1, s2], if_paired=True) cea.plot_CE_plane() nmb_paired = ce.CBA([s0, s1, s2], wtp_range=[0, 100000], if_paired=True) nmb_indp = ce.CBA([s0, s1, s2], wtp_range=[0, 100000], if_paired=False) # list of frontier strategies as input # Try NMB_Lines figure - paired CI nmb_paired.plot_incremental_nmbs(title="deltaNMB lines for paired CI", x_label="wtp values", y_label="NMB values", y_axis_multiplier=0.1, interval_type='c', show_legend=True, figure_size=(6, 5)) # Try NMB_Lines figure - paired PI nmb_paired.plot_incremental_nmbs("deltaNMB lines for paired PI", "wtp values",