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
Exemple #2
0
    def update(self, time, current_state, next_state):

        # cost (per unit of time) during the period since the last recording until now
        cost = self.params.annualStateCosts[current_state.value]
        if current_state == HealthStates.POST_STROKE:
            cost += self.params.annuaAntiCoagCost

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

        # add discounted stoke cost, if stroke occurred
        if next_state == HealthStates.STROKE:
            discounted_cost += Econ.pv_single_payment(payment=self.params.strokeCost,
                                                      discount_rate=self.params.discountRate,
                                                      discount_period=time,
                                                      discount_continuously=True)

        # utility (per unit of time) during the period since the last recording until now
        utility = self.params.annualStateUtilities[current_state.value]
        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
Exemple #3
0
import SimPy.EconEval 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%:')
print(Econ.pv_continuous_payment(payment=10, discount_rate=0, discount_period=(10, 20)))

print('\nEquivalent annual value of $50 over 10 years at discount rate 5%:')
print(Econ.equivalent_annual_value(present_value=50, discount_rate=0.05, discount_period=10))