Пример #1
0
    def update(self, time, current_state, next_state):
        """ updates the discounted total cost and health utility
        :param time: simulation time
        :param current_state: current health state
        :param next_state: next health state
        """

        # cost and utility (per unit of time) during the period since the last recording until now
        cost = self.params.annualStateCosts[
            current_state.value] + self.params.annualTreatmentCost
        utility = self.params.annualStateUtilities[current_state.value]

        # discounted cost and utility (continuously compounded)
        discounted_cost = Econ.pv_continuous_payment(
            payment=cost,
            discount_rate=self.params.discountRate,
            discount_period=(self.tLastRecorded, time))
        discounted_utility = Econ.pv_continuous_payment(
            payment=utility,
            discount_rate=self.params.discountRate,
            discount_period=(self.tLastRecorded, time))

        # update total discounted cost and utility
        self.totalDiscountedCost += discounted_cost
        self.totalDiscountedUtility += discounted_utility

        # update the time since last recording to the current time
        self.tLastRecorded = time
Пример #2
0
def report_CEA_CBA(multi_cohort_outcomes_SOC, multi_cohort_outcomes_NSB):
    """ performs cost-effectiveness and cost-benefit analyses
    :param multi_cohort_outcomes_SOC: outcomes of a multi-cohort simulated under SOC diagnostic
    :param multi_cohort_outcomes_NSB: outcomes of a multi-cohort simulated under NSB diagnostic
    """

    # define two strategies
    SOC_diagnostic_strategy = Econ.Strategy(
        name='SOC Diagnostic',
        cost_obs=multi_cohort_outcomes_SOC.meanCosts,
        effect_obs=multi_cohort_outcomes_SOC.totalYLL,
        color='green'
    )
    NSB_diagnostic_strategy = Econ.Strategy(
        name='NSB Diagnostic',
        cost_obs=multi_cohort_outcomes_NSB.meanCosts,
        effect_obs=multi_cohort_outcomes_NSB.totalYLL,
        color='blue'
    )

    # do CEA
    CEA = Econ.CEA(
        strategies=[SOC_diagnostic_strategy, NSB_diagnostic_strategy],
        if_paired=True,
        health_measure='d'
    )

    # show the cost-effectiveness plane
    show_ce_figure(CEA=CEA)

    # report the CE table
    CEA.build_CE_table(
        interval_type='p',  # prediction intervals
        alpha=D.ALPHA,
        cost_digits=0,
        effect_digits=2,
        icer_digits=2)

    # CBA
    NBA = Econ.CBA(
        strategies=[SOC_diagnostic_strategy, NSB_diagnostic_strategy],
        if_paired=True,
        health_measure='d'
    )
    # show the net monetary benefit figure
    NBA.graph_incremental_NMBs(
        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_type='p',
        show_legend=True,
        figure_size=(6, 5)
    )
Пример #3
0
def report_CEA_CBA(multi_trees_P, multi_trees_N):
    """ 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
    Palivizumab_therapy_strategy = Econ.Strategy(
        name='Palivizumab Therapy',
        cost_obs=multi_trees_P.PCosts,
        effect_obs=multi_trees_P.PQALYs,
        color='green'
    )
    No_prophylaxis_strategy = Econ.Strategy(
        name='No Prophylaxis',
        cost_obs=multi_trees_N.NCosts,
        effect_obs=multi_trees_N.NQALYs,
        color='blue'
    )

    # do CEA
    CEA = Econ.CEA(
        strategies=[Palivizumab_therapy_strategy, No_prophylaxis_strategy],
        if_paired=True
    )

    # show the cost-effectiveness plane
    show_ce_figure(CEA=CEA)

    # report the CE table
    CEA.build_CE_table(
        interval_type='p',  # prediction intervals
        alpha=D.ALPHA,
        cost_digits=0,
        effect_digits=2,
        icer_digits=2)

    # CBA
    NBA = Econ.CBA(
        strategies=[Palivizumab_therapy_strategy, No_prophylaxis_strategy],
        if_paired=True
    )
    # show the net monetary benefit figure
    NBA.graph_incremental_NMBs(
        min_wtp=0,
        max_wtp=5000000,
        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)
    )
Пример #4
0
def report_CEA_CBA(multi_cohort_outcomes_no, multi_cohort_outcomes_asp):

    # define two strategies
    no_therapy_strategy = Econ.Strategy(
        name='Mono Therapy',
        cost_obs=multi_cohort_outcomes_no.meanCosts,
        effect_obs=multi_cohort_outcomes_asp.meanQALYs,
        color='green'
    )
    asp_therapy_strategy = Econ.Strategy(
        name='Combination Therapy',
        cost_obs=multi_cohort_outcomes_asp.meanCosts,
        effect_obs=multi_cohort_outcomes_no.meanQALYs,
        color='blue'
    )

    # do CEA
    CEA = Econ.CEA(
        strategies=[no_therapy_strategy, asp_therapy_strategy],
        if_paired=True
    )

    # show the cost-effectiveness plane
    show_ce_figure(CEA=CEA)

    # report the CE table
    CEA.build_CE_table(
        interval_type='p',  # prediction intervals
        alpha=D.ALPHA,
        cost_digits=0,
        effect_digits=2,
        icer_digits=2)

    # CBA
    NBA = Econ.CBA(
        strategies=[no_therapy_strategy, asp_therapy_strategy],
        if_paired=True
    )
    # show the net monetary benefit figure
    NBA.graph_incremental_NMBs(
        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_type='p',
        show_legend=True,
        figure_size=(6, 5)
    )
    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.params.annualStateCosts[current_state.value] +
                      self.params.annualStateCosts[next_state.value])
        # update utility
        # utility = 0.5 * (self.params.annualStateUtilities[current_state.value] +
        #                  self.params.annualStateUtilities[next_state.value])

        # add the cost of treatment
        # if Chron's death will occur, add the cost for half-year of treatment
        if next_state == P.HealthStates.DEATH:
            cost += 0.5 * self.params.annualTreatmentCost
        else:
            cost += 1 * self.params.annualTreatmentCost

        # update total discounted cost and utility (corrected for the half-cycle effect)
        self.totalDiscountedCost += Econ.pv_single_payment(
            payment=cost,
            discount_rate=self.params.discountRate / 2,
            discount_period=2 * k + 1)
Пример #6
0
    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.params.annualTotalCosts[current_state.value] +
                self.params.annualTotalCosts[next_state.value])
        # # update utility
        # utility = 0.5 * (self.params.annualTotalUtility[current_state.value] +
        #                  self.params.annualTotalUtility[next_state.value])

        # add the cost of treatment
        if current_state == P.HealthStates.ACTIVE_TB and next_state == P.HealthStates.ACTIVE_TB:
            cost += 1 * self.params.annualTreatmentCost
        elif current_state == P.HealthStates.ACTIVE_TB and next_state == P.HealthStates.CURED or P.HealthStates.INCOMPLETE:
            cost += 0.5 * self.params.annualTreatmentCost

        # update total discounted cost and utility (corrected for the half-cycle effect)
        self.totalDiscountedCost += Econ.pv_single_payment(
            payment=cost,
            discount_rate=self.params.discountRate,
            discount_period=k + 1)
Пример #7
0
def report_CEA_CBA(sim_outcomes_amino, sim_outcomes_immuno):
    """ performs cost-effectiveness and cost-benefit analyses
    :param sim_outcomes_amino: outcomes of a cohort simulated under aminosalicylate therapy
    :param sim_outcomes_immuno: outcomes of a cohort simulated under immunosuppresive therapy
    """

    # define two strategies
    amino_therapy_strategy = Econ.Strategy(
        name='Aminosalicylate Therapy',
        cost_obs=sim_outcomes_amino.costs,
        effect_obs=sim_outcomes_amino.numPatientsAlive,
        color='green')
    immuno_therapy_strategy = Econ.Strategy(
        name='Immunosuppresive Therapy',
        cost_obs=sim_outcomes_immuno.costs,
        effect_obs=sim_outcomes_immuno.numPatientsAlive,
        color='blue')

    # do CEA
    CEA = Econ.CEA(
        strategies=[amino_therapy_strategy, immuno_therapy_strategy],
        if_paired=False)

    # show the cost-effectiveness plane
    show_ce_figure(CEA=CEA)

    # report the CE table
    CEA.build_CE_table(interval_type='c',
                       alpha=D.ALPHA,
                       cost_digits=0,
                       effect_digits=2,
                       icer_digits=2)

    # CBA
    NBA = Econ.CBA(
        strategies=[amino_therapy_strategy, immuno_therapy_strategy],
        if_paired=False)
    # show the net monetary benefit figure
    NBA.graph_incremental_NMBs(
        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_type='c',
        show_legend=True,
        figure_size=(6, 5))
Пример #8
0
def report_CEA_CBA(sim_outcomes_SOC, sim_outcomes_NSB):
    """ 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
    SOC_diagnostic_strategy = Econ.Strategy(
        name='SOC Diagnostic',
        cost_obs=sim_outcomes_SOC.costsPresenting,
        effect_obs=sim_outcomes_SOC.listYLLPresenting,
        color='green')
    sim_outcomes_NSB = Econ.Strategy(
        name='NSB Diagnostic',
        cost_obs=sim_outcomes_NSB.costsPresenting,
        effect_obs=sim_outcomes_NSB.listYLLPresenting,
        color='blue')

    # do CEA
    CEA = Econ.CEA(strategies=[SOC_diagnostic_strategy, sim_outcomes_NSB],
                   if_paired=False,
                   health_measure='d')

    # show the cost-effectiveness plane
    show_ce_figure(CEA=CEA)

    # report the CE table
    CEA.build_CE_table(interval_type='c',
                       alpha=D.ALPHA,
                       cost_digits=0,
                       effect_digits=2,
                       icer_digits=2)

    # CBA
    NBA = Econ.CBA(strategies=[SOC_diagnostic_strategy, sim_outcomes_NSB],
                   if_paired=False)
    # show the net monetary benefit figure
    NBA.graph_incremental_NMBs(
        min_wtp=0,
        max_wtp=50000,
        title='Cost-Benefit Analysis',
        x_label='Willingness-to-pay for one additional YLL ($)',
        y_label='Incremental Net Monetary Benefit ($)',
        interval_type='c',
        show_legend=True,
        figure_size=(6, 5))
Пример #9
0
def report_CEA_CBA(sim_outcomes_none, sim_outcomes_treat):
    """ 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
    none_therapy_strategy = Econ.Strategy(
        name='No Therapy',
        cost_obs=sim_outcomes_none.costs,
        effect_obs=sim_outcomes_none.nTotalCured,
        color='green')
    treat_therapy_strategy = Econ.Strategy(
        name='Intervention to Increase Adherence',
        cost_obs=sim_outcomes_treat.costs,
        effect_obs=sim_outcomes_treat.nTotalCured,
        color='blue')

    # do CEA
    CEA = Econ.CEA(strategies=[none_therapy_strategy, treat_therapy_strategy],
                   if_paired=False)

    # show the cost-effectiveness plane
    show_ce_figure(CEA=CEA)

    # report the CE table
    CEA.build_CE_table(interval_type='c',
                       alpha=D.ALPHA,
                       cost_digits=0,
                       effect_digits=2,
                       icer_digits=2)

    # CBA
    NBA = Econ.CBA(strategies=[none_therapy_strategy, treat_therapy_strategy],
                   if_paired=False)
    # show the net monetary benefit figure
    NBA.graph_incremental_NMBs(
        min_wtp=0,
        max_wtp=1000,
        title='Cost-Benefit Analysis',
        x_label='Willingness-to-pay for one additional patient cured ($)',
        y_label='Incremental Net Monetary Benefit ($)',
        interval_type='c',
        show_legend=True,
        figure_size=(6, 5))
Пример #10
0
def report_CEA_CBA(sim_outcomes_NO, sim_outcomes_ASP):

    # define two strategies
    NO_therapy_strategy = Econ.Strategy(name='No Therapy',
                                        cost_obs=sim_outcomes_NO.costs,
                                        effect_obs=sim_outcomes_NO.utilities,
                                        color='green')
    ASP_therapy_strategy = Econ.Strategy(name='Aspirin Therapy',
                                         cost_obs=sim_outcomes_ASP.costs,
                                         effect_obs=sim_outcomes_ASP.utilities,
                                         color='blue')

    # do CEA
    CEA = Econ.CEA(strategies=[NO_therapy_strategy, ASP_therapy_strategy],
                   if_paired=False)

    # show the cost-effectiveness plane
    show_ce_figure(CEA=CEA)

    # report the CE table
    CEA.build_CE_table(interval_type='c',
                       alpha=D.ALPHA,
                       cost_digits=0,
                       effect_digits=2,
                       icer_digits=2)

    # CBA
    NBA = Econ.CBA(strategies=[NO_therapy_strategy, ASP_therapy_strategy],
                   if_paired=False)
    # show the net monetary benefit figure
    NBA.graph_incremental_NMBs(
        min_wtp=0,
        max_wtp=100000,
        title='Cost-Benefit Analysis',
        x_label='Willingness-to-pay for one additional QALY ($)',
        y_label='Incremental Net Monetary Benefit ($)',
        interval_type='c',
        show_legend=True,
        figure_size=(6, 5))
Пример #11
0
from SimPy import EconEvalClasses as ce
import numpy as np

np.random.seed(573)
s_center = np.random.normal(0, 5000, (10, 2))

s0 = ce.Strategy("s1", s_center[0, 0] + np.random.normal(0, 200, 10),
                 s_center[0, 1] + np.random.normal(0, 200, 10))
s1 = ce.Strategy("s2", s_center[1, 0] + np.random.normal(0, 200, 10),
                 s_center[1, 1] + np.random.normal(0, 100, 10))
s2 = ce.Strategy("s3", s_center[2, 0] + np.random.normal(0, 200, 10),
                 s_center[2, 1] + np.random.normal(0, 200, 10))
s3 = ce.Strategy("s4", s_center[3, 0] + np.random.normal(0, 200, 10),
                 s_center[3, 1] + np.random.normal(0, 200, 10))
s4 = ce.Strategy("s5", s_center[4, 0] + np.random.normal(0, 200, 10),
                 s_center[4, 1] + np.random.normal(0, 200, 10))
s5 = ce.Strategy("s6", s_center[5, 0] + np.random.normal(0, 200, 10),
                 s_center[5, 1] + np.random.normal(0, 200, 10))
s6 = ce.Strategy("s7", s_center[6, 0] + np.random.normal(0, 200, 10),
                 s_center[6, 1] + np.random.normal(0, 200, 10))
s7 = ce.Strategy("s8", s_center[7, 0] + np.random.normal(0, 200, 10),
                 s_center[7, 1] + np.random.normal(0, 200, 10))
s8 = ce.Strategy("s9", s_center[8, 0] + np.random.normal(0, 200, 10),
                 s_center[8, 1] + np.random.normal(0, 200, 10))
s9 = ce.Strategy("s10", s_center[9, 0] + np.random.normal(0, 200, 10),
                 s_center[9, 1] + np.random.normal(0, 200, 10))

# create a CEA object -- unpaired
myCEA = ce.CEA([s0, s1, s2, s3, s4, s5, s6, s7, s8, s9], if_paired=False)

# plot with label and sample cloud
Пример #12
0
from SimPy import EconEvalClasses as EV

S0 = EV.Strategy(name='Base', cost_obs=[100], effect_obs=[1])
S1 = EV.Strategy(name='A1', cost_obs=[800], effect_obs=[0.5])
S2 = EV.Strategy(name='A2', cost_obs=[2000], effect_obs=[10])
S3 = EV.Strategy(name='A3', cost_obs=[500], effect_obs=[7])
S4 = EV.Strategy(name='A4', cost_obs=[-100], effect_obs=[2])

cea = EV.CEA(strategies=[S0, S1, S2, S3, S4],
             if_paired=False,
             health_measure=EV.HealthMeasure.UTILITY)

print('On frontier')
for s in cea.get_strategies_on_frontier():
    print(s.name)

print('Not on frontier')
for s in cea.get_strategies_not_on_frontier():
    print(s.name)

cea.show_CE_plane('CE plane',
                  'E[Effect]',
                  'E[Cost]',
                  show_names=True,
                  figure_size=6)
cea.build_CE_table(cost_digits=0, interval_type='n')
Пример #13
0
alpha=0.05

# summary statistics for all conditions
print('Summary Stats OS Cost', simulation.get_sumStat_OS_cost().get_mean())
print('95% Confidence Interval for OS Cost', simulation.get_sumStat_OS_cost().get_t_CI(alpha))
print('Summary Stats No OS Cost', simulation.get_sumStat_NoOS_cost().get_mean())
print('95% Confidence Interval for No OS Cost', simulation.get_sumStat_NoOS_cost().get_t_CI(alpha))
print('Summary Stats OS Utility', simulation.get_sumStat_OS_utility().get_mean())
print('95% Confidence Interval for OS Utility', simulation.get_sumStat_OS_utility().get_t_CI(alpha))
print('Summary Stats No OS Utility', simulation.get_sumStat_NoOS_utility().get_mean())
print('95% Confidence Interval for No OS Utility', simulation.get_sumStat_NoOS_utility().get_t_CI(alpha))
print(" ")

print (" ")

# CEA plot
# currently turning out weird but hopefully will have more of a 'cloud' when we randomize the simulation parameters
s1 = ce.Strategy('Intervention', cost_obs=simulation.get_OS_costs(), effect_obs=simulation.get_OS_utilities())
s2 = ce.Strategy('No Intervention', cost_obs=simulation.get_NoOS_costs(), effect_obs=simulation.get_NoOS_utilities())
myCEA = ce.CEA([s2, s1], if_paired=False)
myCEA.show_CE_plane('CE Plane with cost vs utilities, Bonanza', x_label='Utilities', y_label='Costs',
                   show_legend=True, show_clouds=True, figure_size=6)


# ICER table
print('')
# return none and write result into csv
print(myCEA.build_CE_table(ce.Interval.PREDICTION))
print(myCEA.build_CE_table())

Пример #14
0
import SimPy.EconEvalClasses as EconEval
import numpy as np

np.random.seed(573)

cost_base = np.random.normal(loc=10000, scale=100, size=1000)
effect_base = np.random.normal(loc=2, scale=.1, size=1000)
cost_intervention = np.random.normal(loc=20000, scale=200, size=1000)
effect_intervention = np.random.normal(loc=1, scale=.2, size=1000)

print('')

# ICER calculation assuming paired observations
ICER_paired = EconEval.ICER_paired('Testing paired ICER', cost_intervention,
                                   effect_intervention, cost_base, effect_base,
                                   EconEval.HealthMeasure.DISUTILITY)
print('Paired ICER (confidence and prediction interval): ',
      ICER_paired.get_ICER(), ICER_paired.get_CI(0.05, 1000),
      ICER_paired.get_PI(0.05, ))

# ICER calculation assuming independent observations
ICER_indp = EconEval.ICER_indp('Testing independent ICER', cost_intervention,
                               effect_intervention, cost_base, effect_base,
                               EconEval.HealthMeasure.DISUTILITY)
print('Independent ICER (confidence and prediction interval): ',
      ICER_indp.get_ICER(), ICER_indp.get_CI(0.05, 1000),
      ICER_indp.get_PI(0.05, ))

# try NMB
NMB_paired = EconEval.NMB_paired("Testing paired NMB", cost_intervention,
                                 effect_intervention, cost_base, effect_base,
Пример #15
0
import SimPy.EconEvalClasses as EconEval
import numpy as np

np.random.seed(573)

cost_base = np.random.normal(loc=10000, scale=100, size=1000)
effect_base = np.random.normal(loc=1, scale=.1, size=1000)
cost_intervention = np.random.normal(loc=20000, scale=200, size=1000)
effect_intervention = np.random.normal(loc=2, scale=.2, size=1000)

print('')

# ICER calculation assuming paired observations
ICER_paired = EconEval.ICER_paired('Testing paired ICER',
                                   cost_intervention, effect_intervention, cost_base, effect_base)
print('Paired ICER (confidence and prediction interval): ',
      ICER_paired.get_ICER(),
      ICER_paired.get_CI(0.05, 1000),
      ICER_paired.get_PI(0.05, ))

# ICER calculation assuming independent observations
ICER_indp = EconEval.ICER_indp('Testing independent ICER',
                               cost_intervention, effect_intervention, cost_base, effect_base)
print('Independent ICER (confidence and prediction interval): ',
      ICER_indp.get_ICER(),
      ICER_indp.get_CI(0.05, 1000),
      ICER_indp.get_PI(0.05, ))

# try NMB
NMB_paired = EconEval.NMB_paired("Testing paired NMB",
                                 cost_intervention, effect_intervention, cost_base, effect_base)
Пример #16
0
from SimPy import EconEvalClasses as EV
import numpy as np

np.random.seed(seed=1)

S0 = EV.Strategy(name='Base',
                 cost_obs=np.random.normal(loc=100, scale=10, size=100),
                 effect_obs=np.random.normal(loc=1, scale=.2, size=100))
S1 = EV.Strategy(name='A1',
                 cost_obs=np.random.normal(loc=800, scale=50, size=100),
                 effect_obs=np.random.normal(loc=0.5, scale=0.1, size=100))
S2 = EV.Strategy(name='A2',
                 cost_obs=np.random.normal(loc=2000, scale=200, size=100),
                 effect_obs=np.random.normal(loc=10, scale=1, size=100))
S3 = EV.Strategy(name='A3',
                 cost_obs=np.random.normal(loc=500, scale=50, size=100),
                 effect_obs=np.random.normal(loc=7, scale=1, size=100))
S4 = EV.Strategy(name='A4',
                 cost_obs=np.random.normal(loc=-100, scale=10, size=100),
                 effect_obs=np.random.normal(loc=2, scale=0.1, size=100))

cea = EV.CEA(strategies=[S0, S1, S2, S3, S4], if_paired=False, health_measure='u')

print('On frontier')
for s in cea.get_strategies_on_frontier():
    print(s.name)

print('Not on frontier')
for s in cea.get_strategies_not_on_frontier():
    print(s.name)
Пример #17
0
import SimPy.EconEvalClasses as Econ

print('Present value of $10 collected in year 20 at discount rate 5%:')
print(
    Econ.pv_single_payment(payment=10, discount_rate=0.05, discount_period=20))

print(
    '\nPresent value of $10 collected in year 20 at discount rate 5% (discounted continuously):'
)
print('These 2 numbers should be almost the same:')
print(
    Econ.pv_single_payment(payment=10,
                           discount_rate=0.05,
                           discount_period=20,
                           discount_continuously=True))
print(
    Econ.pv_single_payment(payment=10,
                           discount_rate=0.05 / 100,
                           discount_period=20 * 100,
                           discount_continuously=False))

print(
    '\nPresent value of a continuous payment of $10 over the period [10, 20] at discount rate 5%:'
)
print(
    Econ.pv_continuous_payment(payment=10,
                               discount_rate=0.05,
                               discount_period=(10, 20)))
print(
    '\nPresent value of a continuous payment of $10 over the period [10, 20] at discount rate 0%:'
)
Пример #18
0
print('Summary Stats OS Utility',
      simulation.get_sumStat_OS_utility().get_mean())
print('95% Confidence Interval for OS Utility',
      simulation.get_sumStat_OS_utility().get_t_CI(alpha))
print('Summary Stats No OS Utility',
      simulation.get_sumStat_NoOS_utility().get_mean())
print('95% Confidence Interval for No OS Utility',
      simulation.get_sumStat_NoOS_utility().get_t_CI(alpha))
print(" ")

print(" ")

# CEA plot
# currently turning out weird but hopefully will have more of a 'cloud' when we randomize the simulation parameters
s1 = ce.Strategy('OpSmile',
                 cost_obs=simulation.get_OS_costs(),
                 effect_obs=simulation.get_OS_utilities())
s2 = ce.Strategy('No OpSmile',
                 cost_obs=simulation.get_NoOS_costs(),
                 effect_obs=simulation.get_NoOS_utilities())
myCEA = ce.CEA([s1, s2],
               if_paired=False)  # double check to see if this is paired or not
myCEA.show_CE_plane('CE Plane with cost vs utilities',
                    x_label='Cost',
                    y_label='Utilities',
                    show_legend=True,
                    show_clouds=True,
                    figure_size=6)

#look at class material to see how simulation parameters might have been used to form a cloud
Пример #19
0
from SimPy import EconEvalClasses as ce
import numpy as np

np.random.seed(573)
s_center = np.array([[10000, 0.2], [20000, 0.3], [50000, 0.35]])

s0 = ce.Strategy("s1", s_center[0, 0] + np.random.normal(0, 1000, 10),
                 s_center[0, 1] + np.random.normal(0, 0.01, 10))
s1 = ce.Strategy("s1", s_center[1, 0] + np.random.normal(0, 1000, 10),
                 s_center[1, 1] + np.random.normal(0, 0.01, 10))
s2 = ce.Strategy("s2", s_center[2, 0] + np.random.normal(0, 1000, 10),
                 s_center[2, 1] + np.random.normal(0, 0.05, 10))

nmb_paired = ce.CBA([s0, s1, s2],
                    if_paired=True)  # list of frontier strategies as input
nmb_indp = ce.CBA([s0, s1, s2],
                  if_paired=False)  # list of frontier strategies as input

# Try NMB_Lines figure - paired CI
nmb_paired.graph_deltaNMB_lines(0,
                                50000,
                                "deltaNMB lines for paired CI",
                                "wtp values",
                                "NMB values",
                                interval_type=ce.Interval.CONFIDENCE,
                                show_legend=True,
                                figure_size=6)

# Try NMB_Lines figure - paired PI
nmb_paired.graph_deltaNMB_lines(0,
                                50000,