def update(self, k, current_state, next_state): #update costs cost = 0.5*(self._param.get_annual_state_cost(current_state)+(self._param.get_annual_state_cost(next_state))) \ * self._param.get_delta_t() #update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + (self._param.get_annual_state_utility(next_state)) ) * self._param.get_delta_t() #add the cost of treatment # if stroke death will occur if next_state in [P.HealthStats.DEATH, P.HealthStats.BACKGROUND_DEATH]: cost += 0.5 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() else: cost += 1 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() # update total discounted cost and utility (correct for the half-cycle effect) self._totalDiscountedCost += EconCls.pv( cost, self._param.get_adj_discount_rate() / 2, 2 * k + 1) self._totalDiscountedUtility += EconCls.pv( utility, self._param.get_adj_discount_rate() / 2, 2 * k + 1)
def report_CEA(): """ performs cost-effectiveness and cost-benefit analyses :param simOutputs_mono: output of a cohort simulated under mono therapy :param simOutputs_combo: output of a cohort simulated under combination therapy """ # define two strategies without_therapy = EconCls.Strategy( name='Without Therapy', cost_obs=cohort_ONE.get_total_cost(), effect_obs=cohort_ONE.get_total_utility()) with_therapy = EconCls.Strategy(name='With Therapy', cost_obs=cohort_TWO.get_total_cost(), effect_obs=cohort_TWO.get_total_utility()) # do CEA CEA = EconCls.CEA(strategies=[without_therapy, with_therapy], if_paired=False) # show the CE plane CEA.show_CE_plane(title='Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=6, transparency=0.3) # report the CE table CEA.build_CE_table( interval=EconCls.Interval.CONFIDENCE, alpha=0.05, cost_digits=0, effect_digits=2, icer_digits=2, )
def update(self, k, current_state, next_state): """updates the discounted total cost and health utility :param k: simulation time step :param current_state: current health state :param next_state: next health state """ # update cost cost = 0.5 * (self._param.get_annual_state_cost(current_state) + self._param.get_annual_state_cost(next_state) ) * self._param.get_delta_t() # update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + self._param.get_annual_state_utility(next_state) ) * self._param.get_delta_t() # treatment cost (incurred only in post-stroke state) if current_state is P.HealthStats.TREATMENT: if next_state is [P.HealthStats.DEAD]: cost += 0.5 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() else: cost += 1 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() # update total discounted cost and utility (NOT corrected for the half-cycle effect) self._totalDiscountedCost += \ EconCls.pv(cost,self._param.get_adj_discount_rate(), k) self._totalDiscountedUtility += \ EconCls.pv(utility,self._param.get_adj_discount_rate(), k)
def report_CEA_CBA(simOutputs_US, simOutputs_CT): # strategies strategy_US = Econ.Strategy(name='Ultrasound', cost_obs=simOutputs_US.get_costs(), effect_obs=simOutputs_US.get_utilities()) strategy_CT = Econ.Strategy(name='Computed Tomography', cost_obs=simOutputs_CT.get_costs(), effect_obs=simOutputs_CT.get_utilities()) # CEA CEA = Econ.CEA(strategies=[strategy_US, strategy_CT], if_paired=False) # report CE table CEA.build_CE_table(interval=Econ.Interval.CONFIDENCE, alpha=Data.ALPHA, cost_digits=0, effect_digits=2, icer_digits=2) # CE plane CEA.show_CE_plane(title='Cost-Effectiveness Analysis', x_label="Additional Discounted Utility", y_label='Additional Discounted Cost', show_names=True, show_legend=True, show_clouds=True, figure_size=6, transparency=0.3)
def update(self, k, current_state, next_state): # update cost cost = 0 if next_state in [P.HealthStats.STROKE]: cost += Data.COST_STROKE # update cost of state else: cost += 0.5 * (self._param.get_annual_state_costs(current_state) + self._param.get_annual_state_costs(next_state) ) * self._param.get_delta_t() # add cost of drug treatment if next_state in [P.HealthStats.POST_STROKE]: cost += self._param.get_annual_drug_cost( ) * self._param.get_delta_t() # update utility utility = 0.5 * (self._param.get_annual_state_utilities(current_state) + self._param.get_annual_state_utilities(next_state) ) * self._param.get_delta_t() # update total discounted cost and utility self._totalDiscountedCost += \ EconCls.pv(cost, self._param.get_adj_discount_rate() / 2, 2*k + 1) self._totalDiscountedUtil += \ EconCls.pv(utility, self._param.get_adj_discount_rate() / 2, 2*k + 1)
def update(self, k, current_state, next_state): # update cost cost = 0.5 * (self._parameters.get_annual_state_cost(current_state) + self._parameters.get_annual_state_cost(next_state) ) * self._parameters.get_delta_t() # update utility utility = 0.5 * ( self._parameters.get_annual_state_utility(current_state) + self._parameters.get_annual_state_utility(next_state) ) * self._parameters.get_delta_t() # add cost of treatment if next_state in [Parameters.HealthStates.DEAD]: cost += 0.5 * self._parameters.get_annual_treatment_cost( ) * self._parameters.get_delta_t() else: cost += 1 * self._parameters.get_annual_treatment_cost( ) * self._parameters.get_delta_t() # update total discounted cost and utility (corrected for half-cycle effect) self._totalDiscountedCost += \ EconCls.pv(cost, self._parameters.get_adj_discount_rate() / 2, 2*k + 1) self._totalDiscountedUtility += \ EconCls.pv(utility, self._parameters.get_adj_discount_rate() / 2, 2*k + 1)
def simulate(self, sim_length): """ simulate the patient over the specified simulation length """ # random number generator for this patient self._rng = rndClasses.RNG(self._id) k = 0 # current time step # while the patient is alive and simulation length is not yet reached while (self.healthstat != 3 or self.healthstat != 4) and k * delta_t < sim_length: # find the transition probabilities of the future states trans_probs = TRANS[self.THERAPY][self.healthstat] # create an empirical distribution empirical_dist = rndClasses.Empirical(trans_probs) # sample from the empirical distribution to get a new state # (returns an integer from {0, 1, 2, ...}) new_state_index = empirical_dist.sample(self._rng) if self.healthstat == 1: self.STROKE += 1 #caculate cost and utality cost = TRANS_COST[self.THERAPY][self.healthstat] * delta_t utility = TRANS_UTILITY[self.THERAPY][self.healthstat] * delta_t # update total discounted cost and utility (corrected for the half-cycle effect) self.totalDiscountCost += \ EconCls.pv(cost, Discount_Rate*delta_t, k + 1) self.totalDiscountUtility += \ EconCls.pv(utility, Discount_Rate*delta_t, k + 1) # update health state self.healthstat = new_state_index[0] # increment time step k += 1 self.survival = k * delta_t
def report_CEA_CBA(simOutputs_nodrug, simOutputs_drugtx): """ performs cost-effectiveness and cost-benefit analysis""" # strategies strategy_no_drug = Econ.Strategy( name='No drug', cost_obs=simOutputs_nodrug.get_costs(), effect_obs=simOutputs_nodrug.get_utilities() ) strategy_drug = Econ.Strategy( name='Drug Treatment', cost_obs=simOutputs_drugtx.get_costs(), effect_obs=simOutputs_drugtx.get_utilities() ) # CEA CEA = Econ.CEA( strategies=[strategy_no_drug, strategy_drug], if_paired=False ) # CE plane CEA.show_CE_plane( title='Cost Effectiveness Analysis', x_label='Additional Discounted Utility', y_label='Additional Discounted Cost', show_names=True, show_legend=True, show_clouds=True, figure_size=6, transparency=0.3 ) # report CE table CEA.build_CE_table( interval=Econ.Interval.CONFIDENCE, alpha=Settings.ALPHA, cost_digits=0, effect_digits=2, icer_digits=2 ) # CBA NBA = Econ.CBA( strategies=[strategy_no_drug,strategy_drug], if_paired=False ) # net monetary benefit figure NBA.graph_deltaNMB_lines( min_wtp=0, max_wtp=100000, title='Cost Benefit Analysis', x_label='WTP for one addn QALY ($)', y_label='Incremental Net Monetary Benefit ($)', interval=Econ.Interval.CONFIDENCE, show_legend=True, figure_size=6 )
def update(self, k, current_state, next_state): """ updates the discounted total cost and health utility # :param k: simulation time step # :param current_state: current health state #:param next_state: next health state #""" # update cost cost = 0.5 * (self._param.get_annual_state_cost(current_state) + self._param.get_annual_state_cost(next_state) ) * self._param.get_delta_t() # update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + self._param.get_annual_state_utility(next_state) ) * self._param.get_delta_t() # add the cost of treatment # if HIV death will occur if next_state in [P.HealthStats.STROKEDEATH]: cost += 0.5 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() else: cost += 1 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() # update total discounted cost and utility (corrected for the half-cycle effect) self._totalDiscountedCost += \ EconCls.pv(cost, self._param.get_adj_discount_rate() / 2, 2*k + 1) self._totalDiscountedUtility += \ EconCls.pv(utility, self._param.get_adj_discount_rate() / 2, 2*k + 1)
def report_CBA(simOutputs_mono, simOutputs_combo): """ performs cost-effectiveness analysis :param simOutputs_mono: output of a cohort simulated under mono therapy :param simOutputs_combo: output of a cohort simulated under combination therapy """ # define two strategies mono_therapy_strategy = Econ.Strategy( name='WITHOUT anticoagulation', cost_obs=simOutputs_mono.get_costs(), effect_obs=simOutputs_mono.get_utilities() ) combo_therapy_strategy = Econ.Strategy( name='WITH anticoagulation', cost_obs=simOutputs_combo.get_costs(), effect_obs=simOutputs_combo.get_utilities() ) # CBA NBA = Econ.CBA( strategies=[mono_therapy_strategy, combo_therapy_strategy], if_paired=False ) # show the net monetary benefit figure NBA.graph_deltaNMB_lines( min_wtp=0, max_wtp=50000, title='Problem 4: Cost-Benefit Analysis', x_label='Willingness-to-pay for one additional QALY ($)', y_label='Incremental Net Monetary Benefit ($)', interval=Econ.Interval.CONFIDENCE, show_legend=True, figure_size=6 )
def update(self, k, current_state, next_state): """ updates the discounted total cost and health utility :param k: simulation time step :param current_state: current health state :param next_state: next health state """ # update cost cost = self._param.get_annual_state_cost( current_state) * self._param.get_delta_t() # update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + self._param.get_annual_state_utility(next_state) ) * self._param.get_delta_t() if current_state == P.HealthStats.CD4_200 and next_state != P.HealthStats.CD4_200: cost = cost + 600 + (36.73 + 49.11) if current_state == P.HealthStats.CD4_200to500: cost += 32.68 # add the cost of treatment # if HIV death will occur if next_state in [P.HealthStats.DEATH]: cost += 0.5 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() else: cost += 1 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() # update total discounted cost and utility (corrected for the half-cycle effect) self._totalDiscountedCost += \ EconCls.pv(cost, self._param.get_adj_discount_rate() / 2, 2*k + 1) self._totalDiscountedUtility += \ EconCls.pv(utility, self._param.get_adj_discount_rate() / 2, 2*k + 1)
def update(self, k, current_state, next_state): """ updates the discounted total cost and health utility :param k: simulation time step :param current_state: current health state :param next_state: next health state """ # update cost cost = 0.5 * (self._param.get_annual_state_cost(current_state) + self._param.get_annual_state_cost(next_state)) * self._param.get_delta_t() # update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + self._param.get_annual_state_utility(next_state)) * self._param.get_delta_t() # add the cost of treatment # if DEATH will occur if next_state in [HealthStats.STROKEDEATH] or next_state in [HealthStats.OTHERDEATH] and current_state in [HealthStats.POSTSTROKE]: cost += 0.5 * self._param.get_annual_treatment_cost() * self._param.get_delta_t() elif next_state in [HealthStats.STROKE] and (current_state in [HealthStats.POSTSTROKE] or current_state in [HealthStats.WELL]): cost += 5000 elif current_state in [HealthStats.POSTSTROKE]: cost += 1 * self._param.get_annual_treatment_cost() * self._param.get_delta_t() # update total discounted cost and utility (removed the half-cycle effect) self._totalDiscountedCost += \ Econ.pv(cost, self._param.get_adj_discount_rate() / 2, k + 1) self._totalDiscountedUtility += \ Econ.pv(utility, self._param.get_adj_discount_rate() / 2, k + 1)
def report_CEA_CBA(simOutputs_none, simOutputs_anticoag): """ performs cost-effectiveness analysis :param simOutputs_none: output of a cohort simulated under mono therapy :param simOutputs_anticoag: output of a cohort simulated under combination therapy """ # define two strategies no_therapy_strategy = Econ.Strategy( name='No Therapy', cost_obs=simOutputs_none.get_costs(), effect_obs=simOutputs_none.get_utilities() ) anticoag_therapy_strategy = Econ.Strategy( name='Combination Therapy', cost_obs=simOutputs_anticoag.get_costs(), effect_obs=simOutputs_anticoag.get_utilities() ) # CEA CEA = Econ.CEA( strategies=[no_therapy_strategy, anticoag_therapy_strategy], if_paired=False ) # show the CE plane CEA.show_CE_plane( title='Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=6, transparency=0.3 ) # report the CE table CEA.build_CE_table( interval=Econ.Interval.CONFIDENCE, alpha=Settings.ALPHA, cost_digits=0, effect_digits=2, icer_digits=2, ) # CBA NBA = Econ.CBA( strategies=[no_therapy_strategy, anticoag_therapy_strategy], if_paired=False ) # show the net monetary benefit figure NBA.graph_deltaNMB_lines( min_wtp=0, max_wtp=50000, title='Cost-Benefit Analysis', x_label='Willingness-to-pay for one additional QALY ($)', y_label='Incremental Net Monetary Benefit ($)', interval=Econ.Interval.CONFIDENCE, show_legend=True, figure_size=6 )
def report_CEA_CBA(simOutputs_standard, simOutputs_population): """ performs cost-effectiveness analysis :param simOutputs_standard: output of a cohort simulated under standard testing :param simOutputs_population: output of a cohort simulated under population testing """ # define two strategies standard_testing_strategy = Econ.Strategy( name='Standard Testing', cost_obs=simOutputs_standard.get_costs(), effect_obs=simOutputs_standard.get_utilities()) population_testing_strategy = Econ.Strategy( name='Population Testing', cost_obs=simOutputs_population.get_costs(), effect_obs=simOutputs_population.get_utilities()) # CEA CEA = Econ.CEA( strategies=[standard_testing_strategy, population_testing_strategy], if_paired=False) # show the CE plane CEA.show_CE_plane(title='Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=6, transparency=0.3) # report the CE table CEA.build_CE_table( interval=Econ.Interval.CONFIDENCE, alpha=ALPHA, cost_digits=0, effect_digits=2, icer_digits=0, ) # CBA NBA = Econ.CBA( strategies=[standard_testing_strategy, population_testing_strategy], if_paired=False) # show the net monetary benefit figure NBA.graph_deltaNMB_lines( min_wtp=0, max_wtp=150000, title='Cost-Benefit Analysis', x_label='Willingness-to-pay for one additional QALY ($)', y_label='Incremental Net Monetary Benefit ($)', interval=Econ.Interval.CONFIDENCE, show_legend=True, figure_size=6)
def update(self, k, current_state, next_state): cost = 0.5*(self._param.get_annual_state_cost(current_state)+(self._param.get_annual_state_cost(next_state))) \ * self._param.get_delta_t() utility = 0.5 * (self._param.get_annual_state_utility(current_state) + (self._param.get_annual_state_utility(next_state))) * self._param.get_delta_t() if next_state is P.HealthStats.DEATH: cost += 0.5*self._param.get_annual_treatment_cost() * self._param.get_delta_t() else: cost += 1*self._param.get_annual_treatment_cost() * self._param.get_delta_t() self._totalDiscountedCost += EconCls.pv(cost, self._param.get_adj_discount_rate()/2, 2*k+1) self._totalDiscountedUtility += EconCls.pv(utility, self._param.get_adj_discount_rate()/2, 2*k+1)
def update(self, k, current_state, next_state): cost = (self._param.get_annual_state_cost(current_state)+(self._param.get_annual_state_cost(next_state))) \ * self._param.get_delta_t() utility = (self._param.get_annual_state_utility(current_state) + (self._param.get_annual_state_utility(next_state))) * self._param.get_delta_t() if next_state in [P.HealthStats.DEAD, P.HealthStats.STROKE_DEAD]: cost += self._param.get_annual_treatment_cost() * self._param.get_delta_t() else: cost += 1*self._param.get_annual_treatment_cost() * self._param.get_delta_t() self._totalDiscountedCost += EconCls.pv(payment=cost, discount_rate=self._param.get_adj_discount_rate(), discount_period=k+1) self._totalDiscountedUtility += EconCls.pv(payment=utility, discount_rate=self._param.get_adj_discount_rate(), discount_period=k+1)
def report_CEA_CBA(simOutputs_warfarin, simOutputs_dabigatran_110, simOutputs_dabigatran_150): warfarin_strategy = Econ.Strategy( name="Warfarin", cost_obs=simOutputs_warfarin.get_costs(), effect_obs=simOutputs_warfarin.get_utilities()) dabigatran_110_strategy = Econ.Strategy( name="Dabigatran 110mg", cost_obs=simOutputs_dabigatran_110.get_costs(), effect_obs=simOutputs_dabigatran_110.get_utilities()) dabigatran_150_strategy = Econ.Strategy( name="Dabigatran 150mg", cost_obs=simOutputs_dabigatran_150.get_costs(), effect_obs=simOutputs_dabigatran_150.get_utilities()) listofStrategies = [ warfarin_strategy, dabigatran_110_strategy, dabigatran_150_strategy ] CEA = Econ.CEA(listofStrategies, if_paired=False) # create cost effectiveness analysis plane CEA.show_CE_plane(title='Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=6, transparency=0.3) # report the CE table CEA.build_CE_table( interval=Econ.Interval.CONFIDENCE, alpha=Settings.ALPHA, cost_digits=0, effect_digits=2, icer_digits=3, ) CBA = Econ.CBA(listofStrategies, if_paired=False) # Create Cost benefit analysis figure CBA.graph_deltaNMB_lines( min_wtp=0, max_wtp=50000, x_label="Willingness-to-pay for one additional QALY ($)", y_label="Incremental Net Monetary Benefit ($)", interval=Econ.Interval.CONFIDENCE, transparency=0.4, show_legend=True, figure_size=6, title='Cost Benefit Analysis')
def update(self, k, current_state, next_state): cost = self._param.get_annual_state_cost( current_state) * self._param.get_delta_t() utility = self._param.get_annual_state_utility( current_state) * self._param.get_delta_t() self._totalDiscountedCost += EconCls.pv( cost, self._param.get_adj_discount_rate() / 2, 2 * k + 1) self._totalDiscountedUtility += EconCls.pv( utility, self._param.get_adj_discount_rate() / 2, 2 * k + 1)
def report_CEA(simOutputs_NONE, simOutputs_ANTICOAG): """ performs cost-effectiveness analysis :param simOutputs_mono: output of a cohort simulated under mono therapy :param simOutputs_combo: output of a cohort simulated under combination therapy """ # define two strategies no_therapy_strategy = Econ.Strategy( name='Mono Therapy', cost_obs=simOutputs_NONE.get_costs(), effect_obs=simOutputs_NONE.get_utilities() ) anticoag_therapy_strategy = Econ.Strategy( name='Combination Therapy', cost_obs=simOutputs_ANTICOAG.get_costs(), effect_obs=simOutputs_ANTICOAG.get_utilities() ) # do CEA if Settings.PSA_ON: CEA = Econ.CEA( strategies=[no_therapy_strategy, anticoag_therapy_strategy], if_paired=True ) else: CEA = Econ.CEA( strategies=[no_therapy_strategy, anticoag_therapy_strategy], if_paired=False ) # show the CE plane CEA.show_CE_plane( title='Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=8, transparency=0.3 ) # report the CE table CEA.build_CE_table( interval=Econ.Interval.CONFIDENCE, alpha=Settings.ALPHA, cost_digits=0, effect_digits=2, icer_digits=2, )
def update(self, k, current_state, next_state): # state cost and utility cost = 0.5*(self._param.get_annual_state_cost(current_state) +(self._param.get_annual_state_cost(next_state))) * self._param.get_delta_t() utility = 0.5 * (self._param.get_annual_state_utility(current_state) + (self._param.get_annual_state_utility(next_state))) * self._param.get_delta_t() # treatment cost (incurred only in post-stroke state) #if current_state is P.HealthStats.POST_STROKE: # if next_state is P.HealthStats.DEATH: # cost += 0.5*self._param.get_annual_treatment_cost() * self._param.get_delta_t() # else: # cost += 1*self._param.get_annual_treatment_cost() * self._param.get_delta_t() self._totalDiscountedCost += EconCls.pv(cost, self._param.get_adj_discount_rate()/2, 2*k+1) self._totalDiscountedUtility += EconCls.pv(utility, self._param.get_adj_discount_rate()/2, 2*k+1)
def report_CEA_CBA(simOutputs_ANNUAL, simOutputs_SEMI): annual_MDA = Econ.Strategy(name="Annual MDA", cost_obs=simOutputs_ANNUAL.get_costs(), effect_obs=simOutputs_ANNUAL.get_utilities()) semiannual_MDA = Econ.Strategy(name="Semi-Annual MDA", cost_obs=simOutputs_SEMI.get_costs(), effect_obs=simOutputs_SEMI.get_utilities()) listofStrategies = [annual_MDA, semiannual_MDA] CEA = Econ.CEA(listofStrategies, if_paired=False) CEA.show_CE_plane(title='Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=6, transparency=0.3) # report the CE table CEA.build_CE_table( interval=Econ.Interval.CONFIDENCE, alpha=Settings.ALPHA, cost_digits=2, effect_digits=2, icer_digits=2, ) CBA = Econ.CBA(listofStrategies, if_paired=False) NBA = Econ.CBA(strategies=[annual_MDA, semiannual_MDA], if_paired=False) NBA.graph_deltaNMB_lines( min_wtp=0, max_wtp=900, x_label="Willingness-to-pay for one unit reduction in DALY ($)", y_label="Incremental Net Monetary Benefit ($)", interval=Econ.Interval.CONFIDENCE, transparency=0.4, show_legend=True, figure_size=6, title='Cost Benefit Analysis')
def report_CEA_CBA(simOutputs_none, simOutputs_anticoag): no_therapy_strategy = EconCls.Strategy( name="without vaccination", cost_obs=simOutputs_none.get_total_cost(), effect_obs=simOutputs_none.get_total_utility()) anticoag_therapy_strategy = EconCls.Strategy( name="With vaccination", cost_obs=simOutputs_anticoag.get_total_cost(), effect_obs=simOutputs_anticoag.get_total_utility()) listofStrategies = [no_therapy_strategy, anticoag_therapy_strategy] CEA = EconCls.CEA(listofStrategies, if_paired=False) CEA.show_CE_plane(title='Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=6, transparency=0.3) # report the CE table CEA.build_CE_table( interval=EconCls.Interval.CONFIDENCE, alpha=0.05, cost_digits=0, effect_digits=2, icer_digits=2, ) CBA = EconCls.CBA(listofStrategies, if_paired=False) CBA.graph_deltaNMB_lines( min_wtp=0, max_wtp=50000, x_label="Willingness-to-pay for one additional QALY ($)", y_label="Incremental Net Monetary Benefit ($)", interval=EconCls.Interval.CONFIDENCE, transparency=0.4, show_legend=True, figure_size=6, title='cost benefit analysis')
def report_CEA(simOutputs_mono, simOutputs_combo): """ performs cost-effectiveness analysis :param simOutputs_mono: output of a cohort simulated under mono therapy :param simOutputs_combo: output of a cohort simulated under combination therapy """ # define two strategies mono_therapy_strategy = Econ.Strategy( name='WITHOUT anticoagulation', cost_obs=simOutputs_mono.get_costs(), effect_obs=simOutputs_mono.get_utilities() ) combo_therapy_strategy = Econ.Strategy( name='WITH anticoagulation', cost_obs=simOutputs_combo.get_costs(), effect_obs=simOutputs_combo.get_utilities() ) # CEA CEA = Econ.CEA( strategies=[mono_therapy_strategy, combo_therapy_strategy], if_paired=False ) # show the CE plane CEA.show_CE_plane( title='Problem 4: Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=6, transparency=0.3 ) # report the CE table CEA.build_CE_table( interval=Econ.Interval.CONFIDENCE, alpha=ALPHA, cost_digits=0, effect_digits=2, icer_digits=2, )
def update(self, k, current_state, next_state): # update cost cost = 0.5 * (self._param.get_annual_state_cost(current_state) + (self._param.get_annual_state_cost(next_state)) ) * self._param.get_delta_t() # update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + (self._param.get_annual_state_utility(next_state)) ) * self._param.get_delta_t() # treatment cost (incurred only in post-stroke state) if current_state is P.HealthStats.POST_TIA: if next_state is P.HealthStats.DEAD_OTHER or next_state is P.HealthStats.DEAD_STROKE: cost += 0.5 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() else: cost += 1 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() if current_state is P.HealthStats.POST_MILD_STROKE: if next_state is P.HealthStats.DEAD_OTHER or next_state is P.HealthStats.DEAD_STROKE: cost += 0.5 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() else: cost += 1 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() if current_state is P.HealthStats.POST_MODERATE_SEVERE_STROKE: if next_state is P.HealthStats.DEAD_OTHER or next_state is P.HealthStats.DEAD_STROKE: cost += 0.5 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() else: cost += 1 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() # update total discounted cost and utility self._totalDiscountedCost += EconCls.pv( cost, self._param.get_adj_discount_rate(), k) self._totalDiscountedUtility += EconCls.pv( utility, self._param.get_adj_discount_rate(), k)
def update(self, k, current_state, next_state): # update cost cost = 0.5 * (self._parameters.get_annual_state_cost(current_state) + self._parameters.get_annual_state_cost(next_state) ) * self._parameters.get_delta_t() # update utility utility = 0.5 * ( self._parameters.get_annual_state_utility(current_state) + self._parameters.get_annual_state_utility(next_state) ) * self._parameters.get_delta_t() # add cost of screening cost += self._parameters.get_screening_cost() # update total discounted cost and utility (corrected for half-cycle effect) self._totalDiscountedCost += \ EconCls.pv(cost, self._parameters.get_adj_discount_rate() / 2, 2*k + 1) self._totalDiscountedUtility += \ EconCls.pv(utility, self._parameters.get_adj_discount_rate() / 2, 2*k + 1)
def update(self, k, current_state, next_state): """updates the discounted total cost and health utility :param k: simulation time step :param current_state: current health state :param next_state: next health state """ # update cost cost = 0.5 * (self._param.get_annual_state_cost(current_state) + self._param.get_annual_state_cost(next_state) ) * self._param.get_delta_t() # update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + self._param.get_annual_state_utility(next_state) ) * self._param.get_delta_t() # add the cost of treatment # if DEAD will occur if current_state is P.HealthStats.WELL: cost += 0 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() elif current_state is P.HealthStats.BACKGROUND_DEATH: cost += 0 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() elif current_state is P.HealthStats.STROKE_DEATH: cost += 0 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() elif current_state is P.HealthStats.STROKE: cost += 0 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() else: cost += 1 * self._param.get_annual_treatment_cost( ) * self._param.get_delta_t() # update total discounted cost and utility (NOT corrected for the half-cycle effect) self._totalDiscountedCost += \ EconCls.pv(cost,self._param.get_adj_discount_rate(), k) self._totalDiscountedUtility += \ EconCls.pv(utility,self._param.get_adj_discount_rate(), k)
def update(self, k, current_state, next_state): """ updates the discounted total cost and health utility :param k: simulation time step :param current_state: current health state :param next_state: next health state """ # update cost cost = self._param.get_annual_state_cost( current_state) * self._param.get_delta_t() # update utility utility = self._param.get_annual_state_utility( current_state) * self._param.get_delta_t() if next_state in [P.HealthStats.WELL]: utility += 1 * (Data.SIM_LENGTH - k) # update total discounted cost and utility (corrected for the half-cycle effect) self._totalDiscountedCost += \ EconCls.pv(cost, self._param.get_adj_discount_rate() / 2, 2*k + 1) self._totalDiscountedUtility += \ EconCls.pv(utility, self._param.get_adj_discount_rate() / 2, 2*k + 1)
def update(self, k, current_state, next_state): """ updates the discounted total cost and health utility :param k: simulation time step :param current_state: current health state :param next_state: next health state """ # update cost cost = 0.5 * (self._param.get_annual_state_cost(current_state) + self._param.get_annual_state_cost(next_state)) * self._param.get_delta_t() # update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + self._param.get_annual_state_utility(next_state)) * self._param.get_delta_t() # add the cost of treatment # if stroke will occur if self._currentState == P.HealthStats.STROKE: cost += self._param.get_onetime_Stroke_cost() # update total discounted cost and utility (corrected for the half-cycle effect) self._totalDiscountedCost += \ EconCls.pv(cost, self._param.get_adj_discount_rate(), k) self._totalDiscountedUtility += \ EconCls.pv(utility, self._param.get_adj_discount_rate(), k)
def update(self, k, current_state, next_state): """ updates the discounted total cost and health utility :param k: simulation time step :param current_state: current health state :param next_state: next health state """ # update utility utility = 0.5 * (self._param.get_annual_state_utility(current_state) + self._param.get_annual_state_utility(next_state) ) * self._param.get_delta_t() # update total discounted cost and utility (corrected for the half-cycle effect) self._totalDiscountedUtility += \ EconCls.pv(utility, self._param.get_adj_discount_rate() / 2, 2*k + 1)
def report_CEA_CBA(simOutputs_none, simOutputs2, simOutputs3, simOutputs4): no_change = Econ.Strategy(name="No change", cost_obs=simOutputs_none.get_costs(), effect_obs=simOutputs_none.get_utilities()) supplies = Econ.Strategy(name="Additional Supplies", cost_obs=simOutputs2.get_costs(), effect_obs=simOutputs2.get_utilities()) training = Econ.Strategy(name="Additional Training", cost_obs=simOutputs3.get_costs(), effect_obs=simOutputs3.get_utilities()) supplies_and_training = Econ.Strategy( name="Adding Supplies and Training", cost_obs=simOutputs4.get_costs(), effect_obs=simOutputs4.get_utilities()) listofStrategies = [no_change, supplies, training, supplies_and_training] CEA = Econ.CEA(listofStrategies, if_paired=False) CEA.show_CE_plane(title='Cost-Effectiveness Analysis', x_label='Additional discounted utility', y_label='Additional discounted cost', show_names=True, show_clouds=True, show_legend=True, figure_size=6, transparency=0.3) # report the CE table CEA.build_CE_table( interval=Econ.Interval.CONFIDENCE, alpha=Settings.ALPHA, cost_digits=0, effect_digits=2, icer_digits=2, ) CBA = Econ.CBA(listofStrategies, if_paired=False) CBA.graph_deltaNMB_lines( min_wtp=0, max_wtp=50000, x_label="Willingness-to-pay for one additional QALY ($)", y_label="Incremental Net Monetary Benefit ($)", interval=Econ.Interval.CONFIDENCE, transparency=0.4, show_legend=True, figure_size=6, title='cost benefit analysis')