def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._timeToSTROKE = [] # patients' stroke times #we dont need costs or utilities here. # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # get the patient's time to AIDS time_To_STROKE = patient.get_these_stroke_times() if not (time_To_STROKE is None): self._time_To_STROKE.append(stroke_times) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time is... ', self._survivalTimes) self._sumState_timeToSTROKE = StatCls.SummaryStat( 'Time until STROKE is...', self._timeToSTROKE)
def print_comparative_outcomes(sim_output_high, sim_output_low): # increase in survival time increase = Stat.DifferenceStatIndp(name='Increase in game score', x=sim_output_high, y_ref=sim_output_low) # estimate and CI estimate_CI = Format.format_estimate_interval( estimate=increase.get_mean(), interval=increase.get_t_CI(alpha=0.05), deci=1) print( "Average increase in game score and {:.{prec}%} confidence interval:". format(1 - 0.05, prec=0), estimate_CI) # % increase in survival time relative_diff = Stat.RelativeDifferenceIndp( name='Average % increase in game score', x=sim_output_high, y_ref=sim_output_low) # estimate and CI estimate_CI = Format.format_estimate_interval( estimate=relative_diff.get_mean(), interval=relative_diff.get_bootstrap_CI(alpha=0.05, num_samples=1000), deci=1, form=Format.FormatNumber.PERCENTAGE) print( "Average percentage increase in game score and {:.{prec}%} confidence interval:" .format(1 - 0.05, prec=0), estimate_CI)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._strokelist = [] #self._times_to_AIDS = [] # patients' times to AIDS #self._costs = [] # patients' discounted total costs #self._utilities =[] # patients' discounted total utilities # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # get the number of stroke stroke = patient.get_num_of_stroke() self._strokelist.append(stroke) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumStat_stroke = StatCls.SummaryStat("The number of stroke", self._strokelist)
def __init__(self, simulated_cohort): self._simCohort = simulated_cohort self._sumStat_expectedrewards = Stat.SummaryStat( 'Game Reward', self._simCohort.get_game_rewards()) self._sumStat_probabilityloss = Stat.SummaryStat( 'Probability of Loss', self._simCohort.get_loss_list())
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._eclampsiaTimes = [] # patients' eclampsia times self._utilities = [] self._costs = [] # eclampsia curve self._eclampsiaCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' ec times for patient in simulated_cohort.get_patients(): # get the patient EC time eclampsia_time = patient.get_eclampsia_time() if not (eclampsia_time is None): self._eclampsiaTimes.append( eclampsia_time) # store the EC time of this patient self._eclampsiaCurve.record(eclampsia_time, -1) # update the EC curve self._costs.append(patient.get_total_discounted_cost()) self._utilities.append(patient.get_total_discounted_utility()) # summary statistics self._sumStat_ECTime = StatCls.SummaryStat('Patient Eclampsia time', self._eclampsiaTimes) self._sumStat_cost = StatCls.SummaryStat('Patient discounted cost', self._costs) self._sumStat_utility = StatCls.SummaryStat( 'Patient discounted utility', self._utilities)
def simulate(self): """ simulates all sets of games """ for i in range(len(self._ids)): # create a multiset setofgames = SetOfGames(ids=self._ids[i], prob_head=self._probHead[i], n_games=self._setofgamessize[i]) # simulate the multiset output = setofgames.simulate() # store games outcomes from this set of games self._gameRewards.append(setofgames.get_rewards()) # store average survival time for this set of games self._aveGameRewards.append(output.get_ave_reward()) # store the probability of losing for this set of games self._probLoss.append(setofgames.get_prob_loss()) # after simulating all set of games # summary statistics of mean average reward self._sumStat_meanGameRewards = Stat.SummaryStat( 'Mean Game Reward', self._aveGameRewards) #summary statistics of the average probability of loss self._sumStat_probLoss = Stat.SummaryStat('Probability of Loss', self._probLoss)
def __init__(self, prob_head, n_games): self._gameRewards = [ ] # create an empty list where rewards will be stored # simulate the games for n in range(n_games): # create a new game game = Game(id=n, prob_head=prob_head) # simulate the game with 20 flips game.simulate(20) # store the reward self._gameRewards.append(game.get_reward()) #define the object to do summary stats on self._sumStat_rewards_to_analyze = Stat.SummaryStat( 'Game rewards', self.get_reward_list()) #create a new list to store rewards in the format of 1=lost money, 0=did not lose self._gameLoss = [] for a in range(n_games): if self._gameRewards[a] >= 0: self._gameLoss.append(0) else: self._gameLoss.append(1) #define the object to do summary stats on for the loss prob self._sumStat_prob_loss_to_analyze = Stat.SummaryStat( 'Game rewards', self._gameLoss)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._strokeCounts = [] # patients' stroke counts # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times and stroke counts for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve stroke_count = patient.get_stroke_count() if not (stroke_count is None): self._strokeCounts.append( stroke_count) # store the stroke count of this patient # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumStat_strokeCount = StatCls.SummaryStat( 'Patient stroke count', self._strokeCounts)
def print_comparative_outcomes(simOutputs_mono, simOutputs_combo): """ prints average increase in survival time, discounted cost, and discounted utility under combination therapy compared to mono therapy :param simOutputs_mono: output of a cohort simulated under mono therapy :param simOutputs_combo: output of a cohort simulated under combination therapy """ # Antibiotics exposure time increase_exposure_time = simOutputs_combo.get_sumStat_survival_times().get_total() \ - simOutputs_mono.get_sumStat_survival_times().get_total() print("Increase in total antibiotics exposure time (day):", increase_exposure_time) #### Survival time #### increase_survival_time = Stat.DifferenceStatIndp( name='Increase in survival time', x=simOutputs_combo.get_survival_times(), y_ref=simOutputs_mono.get_survival_times()) # estimate and CI estimate_CI = F.format_estimate_interval( estimate=increase_survival_time.get_mean(), interval=increase_survival_time.get_t_CI(alpha=Settings.ALPHA), deci=2) print( "Average change in antibiotic exposure time (day) " "and {:.{prec}%} confidence interval:".format(1 - Settings.ALPHA, prec=0), estimate_CI) #### Discounted total cost #### increase_discounted_cost = Stat.DifferenceStatIndp( name='Increase in discounted total cost', x=simOutputs_combo.get_costs(), y_ref=simOutputs_mono.get_costs()) # estimate and CI estimate_CI = F.format_estimate_interval( estimate=increase_discounted_cost.get_mean(), interval=increase_discounted_cost.get_t_CI(alpha=Settings.ALPHA), deci=0, form=F.FormatNumber.CURRENCY) print( "Average increase in discounted total cost " "and {:.{prec}%} confidence interval:".format(1 - Settings.ALPHA, prec=0), estimate_CI) #### Discounted total utility #### increase_discounted_utility = Stat.DifferenceStatIndp( name='Increase in discounted total utility', x=simOutputs_combo.get_utilities(), y_ref=simOutputs_mono.get_utilities()) # estimate and CI estimate_CI = F.format_estimate_interval( estimate=increase_discounted_utility.get_mean(), interval=increase_discounted_utility.get_t_CI(alpha=Settings.ALPHA), deci=2) print( "Average increase in discounted total utility " "and {:.{prec}%} confidence interval:".format(1 - Settings.ALPHA, prec=0), estimate_CI)
def __init__(self, simulated_cohort): self._survivalTimes = [] self._numberStrokes_cohort = [] # survival curve self._survivalCurve = \ Path.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append(survival_time) self._survivalCurve.record(survival_time, -1) # summary statistic self._sumStat_survivalTime = Stat.SummaryStat('Patient survival time', self._survivalTimes) # find patients' number of strokes for patient in simulated_cohort.get_patients(): self._numberStrokes_cohort.append( patient.get_number_strokes_individual()) # summary statistic of strokes self._sumStat_numberStrokes = Stat.SummaryStat( 'Patient number of strokes', self._numberStrokes_cohort)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._nums_of_STROKE = [] # number of stroke patients experienced # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append(survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve for patient in simulated_cohort.get_patients(): # get the number of stroke patients experienced num_of_STROKE = patient.get_num_of_stroke() self._nums_of_STROKE.append(num_of_STROKE) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat('Patient survival time', self._survivalTimes) self._sumStat_numOfStroke = StatCls.SummaryStat('Number of strokes a patient experienced', self._nums_of_STROKE)
def print_comparative_outcomes(sim_output_fair_coins, sim_output_unfair_coins): """ prints expected and percentage increase in survival time when drug is available :param sim_output_no_drug: output of a cohort simulated when drug is not available :param sim_output_with_drug: output of a cohort simulated when drug is available """ # increase in rewards increase = Stat.DifferenceStatIndp( name='Increase in survival time', x=sim_output_unfair_coins.get_rewards(), y_ref=sim_output_fair_coins.get_rewards()) # estimate and CI estimate_CI = Format.format_estimate_interval( estimate=increase.get_mean(), interval=increase.get_t_CI(alpha=P.ALPHA), deci=1) print( "Average increase in rewards for casino owners and {:.{prec}%} confidence interval" " when using unfair coins:".format(1 - P.ALPHA, prec=0), estimate_CI) # % increase in rewards relative_diff = Stat.RelativeDifferenceIndp( name='Average % increase in survival time', x=sim_output_unfair_coins.get_rewards(), y_ref=sim_output_fair_coins.get_rewards()) # estimate and CI estimate_CI2 = Format.format_estimate_interval( estimate=-relative_diff.get_mean(), interval=-relative_diff.get_bootstrap_CI(alpha=P.ALPHA, num_samples=1000), deci=1, form=Format.FormatNumber.PERCENTAGE) print( "Average percentage of increase rewards for casino owners and {:.{prec}%} confidence interval" " when using unfair coins:".format(1 - P.ALPHA, prec=0), estimate_CI2)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._times_to_Stroke = [] # patients' times to stroke self._count_strokes = [] self._utilities = [] self._costs = [] # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append(survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve count_strokes = patient.get_number_of_strokes() self._count_strokes.append(count_strokes) self._costs.append(patient.get_total_discounted_cost()) self._utilities.append(patient.get_total_discounted_utility()) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat('Patient survival time', self._survivalTimes) self._sumState_number_strokes = StatCls.SummaryStat('Time until stroke', self._count_strokes) self._sumStat_cost = StatCls.SummaryStat('Patient discounted cost', self._costs) self._sumStat_utility = StatCls.SummaryStat('Patient discounted utility', self._utilities)
def __init__(self, simulated_cohort): self._simulated_cohort = simulated_cohort self._sumstat_expectedvalue = Stat.SummaryStat( 'expected value', self._simulated_cohort.get_payouts()) self._sumstat_losses = Stat.SummaryStat( 'losses', self._simulated_cohort.get_losses())
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._set_of_strokes = [] # patients' numbers of strokes self._time_to_death = [] # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # get the patient's number of strokes num_of_strokes = patient.get_num_strokes() if not (num_of_strokes is None): self._set_of_strokes.append(num_of_strokes) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumState_TotalStrokes = StatCls.SummaryStat( 'number of strokes', self._set_of_strokes)
def __init__(self, simulated_cohort): """ extracts outputs from simulated cohort """ self._survivalTimes = [] self._costs = [] self._utilities = [] for patient in simulated_cohort.get_patients(): # patient survival times survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append(survival_time) # cost and utility self._costs.append(patient.get_total_discounted_cost()) self._utilities.append(patient.get_total_discouted_utility()) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumStat_cost = StatCls.SummaryStat('Patient discounted cost', self._costs) self._sumStat_utility = StatCls.SummaryStat( 'Patient discounted utility', self._utilities)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._times_to_Stroke = [] # patients' times to have had a stroke # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # get the patient's time to post stroke time_to_stroke = patient.get_time_to_Stroke() if not (time_to_stroke is None): self._times_to_Stroke.append(time_to_stroke) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumState_timeToStroke = StatCls.SummaryStat( 'Time until AIDS', self._times_to_Stroke)
def print_comparative_outcomes(simOutputs_mono, simOutputs_combo): """ prints average increase in survival time, discounted cost, and discounted utility under combination therapy compared to mono therapy :param simOutputs_mono: output of a cohort simulated under mono therapy :param simOutputs_combo: output of a cohort simulated under combination therapy """ # increase in survival time under combination therapy with respect to mono therapy if Settings.PSA_ON: increase_survival_time = Stat.DifferenceStatPaired( name='Increase in survival time', x=simOutputs_combo.get_survival_times(), y_ref=simOutputs_mono.get_survival_times()) else: increase_survival_time = Stat.DifferenceStatIndp( name='Increase in survival time', x=simOutputs_combo.get_survival_times(), y_ref=simOutputs_mono.get_survival_times()) # estimate and CI estimate_CI = F.format_estimate_interval( estimate=increase_survival_time.get_mean(), interval=increase_survival_time.get_t_CI(alpha=Settings.ALPHA), deci=2) print( "Average increase in survival time " "and {:.{prec}%} confidence interval:".format(1 - Settings.ALPHA, prec=0), estimate_CI)
def __init__(self, simulated_set): self._simulatedGameSet = simulated_set # summary statistics of game rewards self._sumStat_gameReward = Stat.SummaryStat('game rewards', self._simulatedGameSet.get_rewards()) # summary statistics of probability of loss self._sumStat_prob_loss = Stat.SummaryStat('prob of loss', self._simulatedGameSet.get_probability_loss())
def print_comparative_outcomes(sim_output_unfair, sim_output_fair): increase = Stat.DifferenceStatIndp(name='Increase in rewards', x=sim_output_unfair.get_rewards(), y_ref=sim_output_fair.get_rewards()) # estimate and CI estimate_CI = Format.format_estimate_interval( estimate=increase.get_mean(), interval=increase.get_t_CI(alpha=P.ALPHA), deci=1) print( "Average increase in reward and {:.{prec}%} confidence interval:". format(1 - P.ALPHA, prec=0), estimate_CI) # % increase in survival time relative_diff = Stat.RelativeDifferenceIndp( name='Average % increase in rewards', x=sim_output_unfair.get_rewards(), y_ref=sim_output_fair.get_rewards()) # estimate and CI estimate_CI = Format.format_estimate_interval( estimate=relative_diff.get_mean(), interval=relative_diff.get_bootstrap_CI(alpha=P.ALPHA, num_samples=1000), deci=1, form=Format.FormatNumber.PERCENTAGE) print( "Average percentage increase in reward and {:.{prec}%} confidence interval:" .format(1 - P.ALPHA, prec=0), estimate_CI)
def print_comparative_outcomes(simOutputs_no_therapy, simOutputs_anticoagulation): """ :param simOutputs_no_therapy: :param simOutputs_anticoagulation: :return: """ # increase in survival time under anticoagulation therapy with respect to no therapy if Settings.PSA_ON: increase_survival_time = Stat.DifferenceStatPaired( name='Increase in survival time', x=simOutputs_anticoagulation.get_survival_times(), y_ref=simOutputs_no_therapy.get_survival_times()) else: increase_survival_time = Stat.DifferenceStatIndp( name='Increase in survival time', x=simOutputs_anticoagulation.get_survival_times(), y_ref=simOutputs_no_therapy.get_survival_times()) # estimate and CI estimate_CI = F.format_estimate_interval( estimate=increase_survival_time.get_mean(), interval=increase_survival_time.get_t_CI(alpha=Settings.ALPHA), deci=2) print("Average increase in survival time " "and {:.{prec}%} confidence interval:".format(1 - Settings.ALPHA, prec=0), estimate_CI)
def print_comparative_outcomes(sim_output_no_drug, sim_output_with_drug): """ prints expected and percentage increase in survival time when drug is available :param sim_output_no_drug: output of a fair game :param sim_output_with_drug: output of an unfair game """ # increase in survival time increase = Stat.DifferenceStatIndp(name='Increase in casino rewards', x=sim_output_with_drug.get_rewards(), y_ref=sim_output_no_drug.get_rewards()) # estimate and CI estimate_CI = Format.format_estimate_interval( estimate=increase.get_mean(), interval=increase.get_t_CI(alpha=P.ALPHA), deci=1) print( "Average increase in casino rewards and {:.{prec}%} confidence interval:" .format(1 - P.ALPHA, prec=0), estimate_CI) # % increase in survival time relative_diff = Stat.RelativeDifferenceIndp( name='Average % increase in casino rewards', x=sim_output_with_drug.get_rewards(), y_ref=sim_output_no_drug.get_rewards()) # estimate and CI estimate_CI = Format.format_estimate_interval( estimate=relative_diff.get_mean(), interval=relative_diff.get_bootstrap_CI(alpha=P.ALPHA, num_samples=1000), deci=1, form=Format.FormatNumber.PERCENTAGE) print( "Average percentage increase in casino rewards and {:.{prec}%} confidence interval:" .format(1 - P.ALPHA, prec=0), estimate_CI)
def __init__(self, simulated_cohort): self._simulatedCohort = simulated_cohort self._sumStat_rewards = \ Stat.SummaryStat('total rewards', self._simulatedCohort.get_reward_list()) self._sumStat_loss = \ Stat.SummaryStat('The probability of loss', self._simulatedCohort.get_loss_list())
def __init__(self, set_of_games): self._rewards = set_of_games.get_rewards() # game rewards summary statistics self._sumStat_gameRewards = \ Stat.SummaryStat('Reward list', set_of_games.get_rewards()) # loss probability summary statistics self._sumStat_gameProbLoss = \ Stat.SummaryStat('Probability of loss', set_of_games.get_loss_list())
def __init__(self, simulated_game): self._simulatedGame = simulated_game self._sumStat_gameRewards = \ Stat.SummaryStat('Game rewards', self._simulatedGame.get_reward_list()) self._sumStat_probLoss = \ Stat.SummaryStat('Probability of loss', self._simulatedGame.get_probloss_list()) self._sumStat_casinoRewards = \ Stat.SummaryStat('Casino rewards', self._simulatedGame.get_casino_reward_list())
def __init__(self, simulated_set): """extract outcomes of a simulated set of games""" self._simulatedGameSet = simulated_set # summary statistics on game outcomes (rewards and losses) self._sumStat_gameRewards = Stat.SummaryStat('Game rewards',self._simulatedGameSet.get_rewards()) self._sumStat_gameRewardsOwner = Stat.SummaryStat('Owner reward',self._simulatedGameSet.get_rewards_owner()) self._sumStat_gameLosses = Stat.SummaryStat('Game losses', self._simulatedGameSet.get_losses())
def __init__(self, simulated_game): self._simulatedGame= simulated_game # summary statistics on expected reward self._sumStat_Reward = \ Stat.SummaryStat('The Rewards list', self._simulatedGame.get_reward_list()) self._sumStat_Lossprob=\ Stat.SummaryStat("Loss Probability", self._simulatedGame.get_loss_time())
def __init__(self, game_id): self.game_id = game_id self.reward_list = [] self.sumStat_reward = \ Stat.SummaryStat('Expected reward', self.get_reward_list()) self.prop_list = [] self.sumStat_prop = \ Stat.SummaryStat('Probability of losing money', self.get_prop_list())
def __init__(self, simulated_set_of_games): self._simulatedGameSets = simulated_set_of_games # summary statistics on game rewards self._sumStat_gameRewards = Stat.SummaryStat('Game Rewards', self._simulatedGameSets.get_rewards()) # summary statistic on probability of loss self._sumStat_probLoss = Stat.SummaryStat('Probability of Loss', self._simulatedGameSets.get_prob_loss())
def print_comparative_outcomes(simOutputs_mono, simOutputs_combo): """ prints average increase in survival time, discounted cost, and discounted utility under combination therapy compared to mono therapy :param simOutputs_mono: output of a cohort simulated under mono therapy :param simOutputs_combo: output of a cohort simulated under combination therapy """ # increase in survival time under combination therapy with respect to mono therapy increase_survival_time = Stat.DifferenceStatIndp( name='Increase in survival time', x=simOutputs_combo.get_survival_times(), y_ref=simOutputs_mono.get_survival_times()) # estimate and CI estimate_CI = F.format_estimate_interval( estimate=increase_survival_time.get_mean(), interval=increase_survival_time.get_t_CI(alpha=Settings.ALPHA), deci=2) print( "Average increase in survival time " "and {:.{prec}%} confidence interval:".format(1 - Settings.ALPHA, prec=0), estimate_CI) # increase in discounted total cost under combination therapy with respect to mono therapy increase_discounted_cost = Stat.DifferenceStatIndp( name='Increase in discounted cost', x=simOutputs_combo.get_costs(), y_ref=simOutputs_mono.get_costs()) # estimate and CI estimate_CI_cost = F.format_estimate_interval( estimate=increase_discounted_cost.get_mean(), interval=increase_discounted_cost.get_t_CI(alpha=Settings.ALPHA), deci=0, form=F.FormatNumber.CURRENCY) print( "Average increase in discounted cost " "and {:.{prec}%} confidence interval:".format(1 - Settings.ALPHA, prec=0), estimate_CI_cost) # increase in discounted total utility under combination therapy with respect to mono therapy increase_discounted_utility = Stat.DifferenceStatIndp( name='Increase in discounted cost', x=simOutputs_combo.get_utilities(), y_ref=simOutputs_mono.get_utilities()) # estimate and CI estimate_CI_utility = F.format_estimate_interval( estimate=increase_discounted_utility.get_mean(), interval=increase_discounted_utility.get_t_CI(alpha=Settings.ALPHA), deci=2) print( "Average increase in discounted utility " "and {:.{prec}%} confidence interval:".format(1 - Settings.ALPHA, prec=0), estimate_CI_utility)